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

Gabriel Dos Reis gdr at axiomatics.org
Thu Oct 17 16:32:09 CEST 2013


Nevin Liber <nevin at eviloverlord.com> writes:

| On 16 October 2013 10:50, Gabriel Dos Reis <gdr at axiomatics.org> 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 17.6.4.2.1p1: "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


More information about the ub mailing list