Boost logo

Boost :

Subject: [boost] Bug in intrusive_ptr,scoped_ptr,scoped_array
From: Hansi (hansipet_at_[hidden])
Date: 2009-02-28 10:41:37


Hello,

at least with VS2005 there is a bug in the three smart pointers...
If you want to check if the pointer is empty (with unspecified bool)
then you get also with NULL a true back.

For this the following fix should work:

#if defined( _MANAGED )

     static void unspecified_bool( this_type*** )
     {
     }

     typedef void (*unspecified_bool_type)( this_type*** );

     operator unspecified_bool_type() const // never throws
     {
         return px == 0? 0: unspecified_bool;
     }
#else
....
#endif

Best regards
Hansjörg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk