C++ Logo


Advanced search

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

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Thu, 17 Oct 2013 10:19:09 -0500
Nevin Liber <nevin_at_[hidden]> 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

Received on 2013-10-17 17:19:10