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

Stefan Seefeld seefeld at sympatico.ca
Thu Nov 9 18:58:43 CET 2006


Stefan Seefeld wrote:

> namespace bpl = boost::python;
> bpl::object your_wrapper(your_class_returning_variant &instance)
> {
>   Variant v = instance.the_method();
>   if (v.type == 0) return bpl::object(instance.i); // make a copy of i
>   else return bpl::object(bpl::ptr(instance.t));   // accept t directly

Sorry, replace 'instance' by 'v' in the preceding two lines.

> }

Regards,
		Stefan


-- 

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



More information about the Cplusplus-sig mailing list