Boost logo

Boost :

Subject: Re: [boost] [safebool] Can we generalize it and put it into utilities?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-29 21:44:28


Vladimir Batov wrote:
>> vicente.botet <vicente.botet <at>> writes:
>> class Foo
>> { ...
>> operator safebool::unspecified_bool_type() const {
>> return safebool(my_condition);
>> }
>> };
> For users' sake I'd like to stay within the mainstream vocabulary. Like type,
> value, result, etc. Indeed, for an initiated person the "unspecified_bool_type"
> looks familiar. However, I still remember the what-the... feeling when I came
> across it first time.
>> I like it anyway,
> Glad to hear I am not alone.

I've written this far too many times, so I also would appreciate
a common solution. I think it would be more straightforward
to use a namespace scope typedef and a free function rather
than a class, though.

typedef ... safe_bool;
safe_bool make_safe_bool(bool);

In Christ,
Steven Watanabe

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