Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-11-21 16:52:31


"Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> wrote in message
news:1373D6342FA1D4119A5100E029437F6401169E7B_at_clifford.devo.ilx.com...
> > > Maybe it's a minor point, but I think the !! is really
> > ugly. Have you
> > > considered the safe_bool idiom that's used in some other Boost
> > > libraries? (smart_ptr to name one.)
> > >
> > Yes, I did.
> > safe_bool (among other alternatives) was rejected because of
> > the following
> > (this specific point is explained in detail on the documentation)
> >
> > void foo()
> > {
> > optional<bool> opt = get_some();
> > bool is_it = opt;
> > }
>
> Did you consider to provide bool specialization that does not have
safe_bool
> convertion and allowing it for all other types?
>
Yes, I did it too. The problem is that in this case, optional<T!=bool> and
optional<bool> would have different semantics; subtly different actually,
which is worst.
I much prefer a consistent semantic.

--
Fernando Cacciola

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