Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-12-11 12:22:26

From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> 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. ;-)

> However, I'm still unconvinced that uninitialized optionals should compare
> false,
> and even though, you can always compare optional values (via operator*),
> 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.

You should consider providing operator<<(std::ostream&, optional), too.

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