C++ Logo


Advanced search

Re: [ub] Justification for < not being a total order on pointers?

From: Nevin Liber <nevin_at_[hidden]>
Date: Wed, 16 Oct 2013 16:57:34 -0500
On 16 October 2013 10:50, Gabriel Dos Reis <gdr_at_[hidden]> wrote:

> Exactly! I said std::less<std::complex<MyFloat>>, which has always been
> supposed to be user-provided, when defined. Since C++98.

Where is the text in the standard or TR/TS (which is the only official
communication between the committee and developers) which states that?

All I can find in n3797 is "A program may add a template
for any standard library template to namespace std only if the declaration
depends on a user-defined type
and the specialization meets the standard library requirements for the
original template and is not explicitly

Unless we are willing to say that std::less<T> has no requirements, I don't
see how we give permission for specializing that in a way which does not
match operator<.

> And codes
> like that exist.

That is certainly true. Users are clever whether or not they are on the
committee. :-)

> The relation with your argument is that those C++98
> codes will continue to work today with C++11, while the version with
> less<void> will fail. Miresably.

Like I said, it's a long term plan...
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

Received on 2013-10-16 23:58:15