[C++-sig] Re: Re: creating an instance of a class_<> object in c++and exporting it to python

Mike Rovner mike at nospam.com
Tue Aug 17 20:45:37 CEST 2004


Francois Ostiguy wrote:
> class_< A, A*, boost:noncopyable>
>
> registers a type converter from A* to Python and it is through this
> converter that the object becomes an instance of the Python type A.

It's (a) create a pytype wrapper class and (b) registers a type converter
unless
you specify boost:noncopyable as you did.

> Does this mean that only one Python type can/should be declared as
> holder of a  A* ?  In other words, is it possible to declare two
> Python types, say A1 and A2, both holding a A* but with different
> exported interfaces ?

You can't have multiple converters. You'll get a boost compile error trying.

> object PythonInstanceOfA( a ) ; // a is a raw ptr to A
>
> does not work.

boost:noncopyable prevents converting c++ value to python.

My .02. Let's Dave correct me.

Mike






More information about the Cplusplus-sig mailing list