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

Nevin Liber nevin at eviloverlord.com
Wed Oct 16 17:55:32 CEST 2013


On 16 October 2013 10:53, Gabriel Dos Reis <gdr at axiomatics.org> wrote:

> Ville Voutilainen <ville.voutilainen at gmail.com> writes:
>
> | On 16 October 2013 18:46, Gabriel Dos Reis <gdr at axiomatics.org> wrote:
> |
> |
> |     |     My own personal view (not that of chair) is that if
> std::less<T>(l,r)
> |     and
> |     |     "l < r" are
> |     |     both defined, then they should yield the same answer.
> |     |
> |     |
> |     | Which fails for pointers.
> |
> |     "fails" in which sense?  It is certainly true in the current
> standards
> |     these expressions are both defined when 'l' and 'r' are related
> |     addresses (relative to the same object), which was exactly my point.
> |
> | Fails in the sense that less<int*>(l, r) and l<r do not necessarily
> yield the
> | same answer.
>
> Only on the cases, e.g. input values, where they aren't both defined.
>

Only because they have different preconditions.  They shouldn't.
-- 
 Nevin ":-)" Liber  <mailto:nevin at eviloverlord.com>  (847) 691-1404
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/ub/attachments/20131016/c68d6a53/attachment-0001.html 


More information about the ub mailing list