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


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;

Best regards

Boost list run by bdawes at, gregod at, cpdaniel at, john at