
On Sat, May 28, 2011 at 9:22 AM, Krzysztof Czainski <1czajnik@gmail.com> wrote:
Thank you all for such large input ;-)
So the way I see it, most of us agree it would be nice to see one official safe-bool implementation tool in boost.
The first question is: should it be a CRTP class, or should it be a macro, or both perhaps?
I suggest we talk about the name after we answer the first question ;-) And later I will try to prepare an implementation with the compiler workarounds mentioned in this thread.
CRTP class usage: struct X : public convertible_to_bool<X> { bool operator!() const { return condition; } // inherit operator unspecified_bool_t implemented in terms of the above operator! };
Macro usage: BOOST_EXPLICIT_BOOL_OPERATOR() const { return ...; }
I'm not sure how the macro would be implemented, but we'll get to that once we make the choice.
Right now I feel convinced to the macro version.
Regards Kris
I suspect that we should offer both versions. I also think we should look back at the previous reviews and attempts at safe-bools for Boost. Although I don't think we should let the previous failed attempts discourage us. Tony