Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-03-24 22:27:16


Do you really want the key to an associative container to be an optional
value ? I would be hard-pressed to find a use for that.

Joe Gottman wrote:
> It would be nice if boost::optional<T> had operator< defined
> whenever operator< was defined for T. This would allow us to use
> optional<T> as the key of an associative container. I suggest the
> following semantics:
>
> bool operator<(optional<T> const &x, optional<T> const &y);
>
> Returns: If y is uninitialized, false. If y is initialized and x is
> uninitialized, true. If x and y are both initialized, (*x < *y).
>
>
>
> This results in a strict weak ordering with uninitialized
> optional<T> objects being sorted first.


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