Boost logo

Boost :

Subject: Re: [boost] [optional] operator<(optional<T>, T) -- is it wrong?
From: Olaf van der Spek (ml_at_[hidden])
Date: 2014-12-01 06:22:44

On Mon, Dec 1, 2014 at 2:31 AM, Matt Calabrese <rivorus_at_[hidden]> wrote:
>> I think this kind of reasoning isn't very fruitful.
>> Optional is not a string, string is not an optional. One having
>> operator< does not imply the other should have it to.
> Hmm? What isn't reasonable is arbitrarily deciding what should and should
> not have a default ordering (not talking about operator< since that's a

True, but it's NOT an arbitrary decision, is it?

> much more controversial matter). The notion of default ordering is useful
> because many datastructures and algorithms can make use of it, particularly

What std datastructures use it?

> those in the standard. There is absolutely nothing wrong with ordering
> tuples or optionals or variants, or any type at all.

That's what you keep saying but you don't back it up.

> The only thing you
> accomplish by not having a default ordering is that you arbitrarily make
> the type difficult to use with these datastructures and algorithms. The

Having to explicitly pass in a comparator is not difficult is it?

> recommendation of "prefer unordered set" is already an example of the type
> of poor programming advice that comes from this as a side effect.


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