----- Original Message -----
From: "Peter Dimov" <[EMAIL PROTECTED]>
To: "Boost mailing list" <[EMAIL PROTECTED]>
Sent: Tuesday, December 10, 2002 9:23 AM
Subject: Re: [boost] Formal review: Optional library


> From: "Fernando Cacciola" <[EMAIL PROTECTED]>
> > The conversion to bool for a smart pointer unambiguously refers to the
> > NULL state of the pointer wrapped.
> > In the case of optional, a conversion to bool will be ambiguous in those
> > cases were the wrapped T in optional<> is bool itself.
>
> On the other hand, it would enable the useful idiom
>
> if(optional<T> pt = get_optional_T())
> {
> // use *pt
> }
>
Yes, it would.

> I don't think that optional<bool> is an important use case (outside of
> generic contexts) since optional<bool> is simply a tri-state type with an
> inconvenient interface.
>
Good point. I've been using optional<bool> long before tribool existed.
Now I might replace optional<bool> with tribool;  but, a user still
can have optional<bool>.
I wouldn't specialize optional<bool> for reasons I gave before.
Though I see that you've found a really useful idiom, I still not sure it
worth
the potential danger. (see my response to William)

Fernando Cacciola

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to