Boost logo

Boost :

Subject: Re: [boost] [optional] operator<(optional<T>, T) -- is it wrong?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-11-30 18:56:28


Mere moments ago, quoth I:
> Optional is more borderline. I don't really have a problem with
> comparing two optionals, or even the default "none is less than
> anything" relation. But when you start mixing comparisons with
> implicitly-promoted-non-optionals you increase the risk of unintended
> bugs (eg. opt < 5 is true but the intended comparison was opt && *opt <
> 5, which is false).

I should probably clarify that I meant that if op< exists, I am most
comfortable with "none" sorting below any other value rather than any of
the alternatives. But I would be happier if "none" had no ordering and
op< did not exist.


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