[C++-sig] Boost.Python call policies at runtime...

Stefan Seefeld seefeld at sympatico.ca
Thu Nov 9 17:34:40 CET 2006


Kevin Jones wrote:
> Hi all,
> 
> Given a class called Variant that can (at runtime)
> contain either an int or a T*. 
> 
> I.E. 
>   class Variant {
>     public:
>       int type;
>       union {
>         int i;
>         T* t;
>       };
>   };

What is 'T' ?

> How can I create a call policy that uses
> return_by_value when Variant is an int or
> manage_new_object when Variant is a T* (based on the
> value of "type" at runtime)?

What do you want to call that returns either of the two ?

> Note: I need to wrap either the int as a python object
> or T* as a python object and not Variant.

You have given far too little information about what you
want to do (both in C++ as well as python) for anybody to
be able to help.


Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list