Boost logo

Boost Users :

From: wasekvesely vaclav.vesely_at_[hidden])
Date: 2003-01-29 12:10:53


Hi,

I've found this in "shared_ptr.hpp":

// implicit conversion to "bool"
typedef T * (this_type::*unspecified_bool_type)() const;

operator unspecified_bool_type() const // never throws
{ return px == 0? 0: &this_type::get; }

Why this is better than:

operator bool() const
{ return px != 0; }

What more can I do with somethin like this?

Thank you,
Wasek


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net