|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-11-21 17:38:18
"Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> wrote in message
news:1373D6342FA1D4119A5100E029437F6401169E7D_at_clifford.devo.ilx.com...
> > > 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.
>
> What about vector<bool>?
> IMO that this inconsistent semantic is reasonable price for better
> usability.
Exactly.
I don't like vector<bool>. It has different semantics and so it should have
been a *different* class.
>
> Moreover I would prohibit optional<bool> at all. Area of application of
such
> class supposedly much better covered by tri-state bool discussed recently.
>
I don't think that prohibiting optional<bool> is a good idea.
I think I agree that tribool is likely to cover all the cases were
optional<bool> would be used, but disabling optional<bool> would create a
genericity problem in case you use optional<T> and T happens to be bool.
-- Fernando Cacciola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk