----- Original Message -----
From: "Peter Dimov" <[EMAIL PROTECTED]>
To: "Boost mailing list" <[EMAIL PROTECTED]>
Sent: Wednesday, December 11, 2002 2:22 PM
Subject: Re: [boost] Formal review: Optional library


> From: "Fernando Cacciola" <[EMAIL PROTECTED]>
> [...]
> > Conclusion: I will adopt William's reset, leaving operator*() return
> > a reference to the optional value *only* if it is initialized
> > (independently of whether opt is const or not).
> >
> > Therefore, the proxy is not needed. And so value() isn't needed either.
> >
> > (B)
> > Since most reviewers wanted it, I will add a safe_bool idiom, which will
> > allow
> > conditional expressions like:
> >
> > if ( opt )
> > if ( opt == 0 )
> > if ( opt != 0 )
>
> Can you please update the documentation to reflect the changes? I want to
> vote on the revised version. ;-)
>
Yes, but first look at my last post where I show the new interface entirely.
If that is more or less OK I'll update the documentation in order to
continue with the review.


> > However, I'm still unconvinced that uninitialized optionals should
compare
> > false,
> > and even though, you can always compare optional values (via operator*),
> so
> > I see no benefit in defining relational operators directly (thus these
> > operators
> > will be poisoned)
>
> I think that the proposed comparisons make a lot of sense.
>
Just to make sure I understand what you're saying:
Do you agree about having comparisons undefined for optionals directly
and only defined for optional values (i.e. *opt1==*opt2)?

>
> You should consider providing operator<<(std::ostream&, optional), too.
>
Interesting...
The idea is that if the optional is uninitialized, it outputs something like
"[NULL]",
else forwards to T::operator <<(), right?

I agree it is usefull, but I'm not sure if it should be provided by the
library itself.
A user can define a sort of to_string() with whatever output he wants for
uninitialized.

Fernando Cacciola

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

Reply via email to