[C++-sig] Patch implementing void * support

Niall Douglas s_sourceforge at nedprod.com
Mon Nov 7 16:29:37 CET 2005


On 7 Nov 2005 at 8:54, Brian Ray wrote:

> I wish someone can tell me in what cases this is useful. I am sure it  
> *is* helpful but I am trying to imagine another more extensive use  
> case. Or, is this something more useful to Python Boost itself and  
> not users of Python Boost.

A lot of GUI toolkit C++ code has message handlers of the form:

virtual int Widget::handle(MsgType msg, void *data)

... where MsgType specifies what *data is. For almost all cases, the 
python bindings will call the C++ implementation and just pass the 
void * unchanged. Where an override is made, you can write separate 
little accessor functions to restore type info to data so python can 
access it.

This idiom is especially popular in C code too.

Cheers,
Niall






More information about the Cplusplus-sig mailing list