Boost logo

Boost :

Subject: Re: [boost] safe-bool CRTP class
From: Bryce Lelbach (blelbach_at_[hidden])
Date: 2011-05-27 16:42:19

Such a class is already in Boost, in two places:


smart_ptr also has a version.

Attached is a modified version of this that incorporates portability code from
the smart_ptr version into the variant of the spirit safe_bool that Hartmut and
I use at work.

I like to have a macro for this, so I have an operator that's convertible to the
safe_bool class, which is itself convertible to bool (this avoids problem with
the need for "typename" in the macro in certain contexts). The safe_bool class
is itself convertible to bool.

Feel free to incorporate any of this code into whatever comes out of this thread.

Bryce Lelbach aka wash

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