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

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


Nevin Liber <nevin at eviloverlord.com> writes:

| But, even if segmented architectures, unlikely though it is, do come back, the
| ordering problem still has to be addressed, as std::less<T*> is required to
| totally order pointers.  I just want operator< to be an alternate spelling for
| that property.

I will repeat this again: std::less<T*> is absolutely not a problem,
because this

      return intptr_t(p) < intptr_t(q);

is valid and portable definition that requires no other special handling.

-- Gaby


More information about the ub mailing list