C++ Logo


Advanced search

Subject: Re: [ub] Justification for < not being a total order on pointers?
From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2013-10-17 09:32:09

Nevin Liber <nevin_at_[hidden]> writes:

| 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?

You just quoted the relevant part below. What specifically different
were you looking for?

| All I can find in n3797 is "A program may add a template
| specialization
| 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
| prohibited."
| 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<.

In the C++98 text, exactly which requirement a user-specialization of

    std::less<std::complex<MyFloat> >

do you believe was violated?

|  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...

-- Gaby

SG12 list run by herb.sutter at gmail.com