> -----Original Message-----
> From: Giovanni Bajo [mailto:[EMAIL PROTECTED]
> 
> 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);
> assert(a.ptr);
> assert(a);
> 
> 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?

I would suspect your compiler.  This works as expected (e.g., no assertions;
they both evaluate to true) with Borland C++ Builder 5.6 and GCC 3.2
prerelease.

        -Steve
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to