[C++-sig] Re: boost.python extract and smart-pointer

David Abrahams dave at boost-consulting.com
Mon Aug 23 17:12:36 CEST 2004


"Baptiste Lepilleur" <gaiacrtn at free.fr> writes:

>     I'm running in some trouble with extract during unpickling of
> null smart-pointer. I have registered a intrusive_ptr based
                             ^^^^^^^^^^
Registered how?  Please show code.

> smart-pointer which works greatly.
>
>     During pickling, my null smart-pointer converted into None. During
> unpickling, when I use extract<MyPtrType> on a null smart-pointer I get a
> conversion error saying that there is no conversion from NoneType to
> MyPtrType.
>
>     Is this a known issue, or did I miss something ?
>
>     As a work-around I tried to test if tuple[1] was None, but couldn't
> figure out how to do that in C++. Any tips ?

if (tuple[1].ptr() == object().ptr()) ...

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list