Boost logo

Boost :

From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2003-03-26 12:02:50


I have observed a strange behaviour with shared_ptr:

struct A
   shared_ptr<int> ptr;

   operator bool()
   { return ptr; }

A a;
a.ptr.reset(new int);

Now, the second assertion fails (Comeau). It works if for example I change
my operator bool into "return ptr ? true : false;". This is
counter-intuitive to me. Can anybody explain me why?

Giovanni Bajo

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