Boost logo

Boost :

Subject: Re: [boost] safe-bool CRTP class
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-28 12:02:39


Krzysztof Czainski 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.
>
>

Hi, recently we were discussion on whether we can add new classes to the
boost namespace, and it seems that we shouldn't.

What would be the namespace for the class or the prefix used for the macro
in this case?
Should this be one of the exceptions to the rule?

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/safe-bool-CRTP-class-tp3555415p3557669.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk