Boost logo

Boost :

Subject: Re: [boost] [optional] operator<(optional<T>, T) -- is it wrong?
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-11-25 22:33:37

On 11/25/2014 10:20 PM, Matt Calabrese wrote:
> On Tue, Nov 25, 2014 at 5:27 PM, Edward Diener <eldiener_at_[hidden]>
> wrote:
>> On 11/25/2014 7:18 PM, Vicente J. Botet Escriba wrote:
>>> Following your reasoning, I will suggest to remove the implicit
>>> construction from T to optional<T> and/or remove the
>>> operator<(optional<T>, optional<>). If we can not live without them, we
>>> could always try to do whatever is better.
>> I do not understand why anyone feels that the less than operator for
>> boost::optional<T> is wrong.
> I can MAYBE see not having them as long as std::less and family are still
> specialized accordingly (specializing std::less is [correctly, IMO] in for
> the proposed standard optional now anyway, thanks to Tony Van Eerd).
> Ultimately, though, I really don't think there's a problem with also having
> the operators overloaded. I simply don't buy the "gotchas."

If the C++ standard says that associative container of std::optionals is
fine but some programmers believe that manually comparing them via the
less than operator is not fine, I think we have a real conceptual
problem here, even outside of the mere non-orthogonality of the situation.

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