Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-09-21 18:08:58


Ariel Badichi <abadichi_at_[hidden]> writes:

> David Abrahams wrote:
>>
>> Another thought:
>>
>> g = 0;
>>
>> it's easy to arrange that only a literal zero works there.
>
> How?

Allow assignment only from a private member pointer type. It's
similar to the operator safe_bool idiom.

>> I don't love it, but maybe it will get your ideas flowing.
>>
>
> Something like:
>
> g = guard::inactive;
> g = guard::active;
>
> or maybe
>
> g = guard::dismissed;
> g = !guard::dismissed;
> (ugh)
>
> ?

No, the whole point of

    g = 0;

was to get you out of having to find a name for this thing.

> Overloading operators here may be a bit counter-intuitive.

Maybe so. I have no strong opinion on the matter.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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