> From: Darin Adler [mailto:darin@bentspoon.com]
>
> 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 library. It's inelegant in implementation, but a lot
> of people like the "if (p)" idiom.
>
> -- Darin
I've noticed that the current version in the CVS does exactly this. It's really neat, as it enables a very useful idiom without sacrificing safety.
Bjorn