From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-08 05:05:46
From: "Darin Adler" <darin_at_[hidden]>
> Some people
> have developed a "safe_bool" idiom where you define a conversion to an
obscure type of pointer (a particularly obscure variant of a pointer to a
member) so you can do "if (p)" statements, but not "int i = p" statements.
It's used in the Boost function library.
> We might want to consider using this technique in the smart pointer
It's already being used. It allows
if(shared_ptr<T> p = make_shared(wp))
if(shared_ptr<T> p = shared_dynamic_cast<T>(p2))
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk