Title
Tuple comparison
Status
lewg
Section
[tuple.rel][tr.tuple.rel]
Submitter
David Abrahams

Created on 2005-11-29.00:00:00 last changed 114 months ago

Messages

Date: 2010-10-21.18:28:33

[ San Francisco: ]

Solved by N2770.

Date: 2010-10-21.18:28:33

Rationale:

Recommend NAD. This will be fixed with the next revision of concepts.

Date: 2010-10-21.18:28:33

[ Berlin: This issue is much bigger than just tuple (pair, containers, algorithms). Dietmar will survey and work up proposed wording. ]

Date: 2010-10-21.18:28:33

Proposed resolution:

change 6.1.3.5/5 from:

Returns: The result of a lexicographical comparison between t and u. The result is defined as: (bool)(get<0>(t) < get<0>(u)) || (!(bool)(get<0>(u) < get<0>(t)) && ttail < utail), where rtail for some tuple r is a tuple containing all but the first element of r. For any two zero-length tuples e and f, e < f returns false.

to:

Returns: The result of a lexicographical comparison between t and u. For any two zero-length tuples e and f, e < f returns false. Otherwise, the result is defined as: cmp( get<0>(t), get<0>(u)) || (!cmp(get<0>(u), get<0>(t)) && ttail < utail), where rtail for some tuple r is a tuple containing all but the first element of r, and cmp(x,y) is an unspecified function template defined as follows.

Where T is the type of x and U is the type of y:

if T and U are pointer types and T is convertible to U, returns less<U>()(x,y)

otherwise, if T and U are pointer types, returns less<T>()(x,y)

otherwise, returns (bool)(x < y)

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

If we solve this for tuple we would have to solve it for pair algorithms, etc. It is too late to do that at this time. Move to NAD Future.

Date: 2009-07-28.00:00:00

[ 2009-07-28 Reopened by Alisdair. No longer solved by concepts. ]

Date: 2005-11-29.00:00:00

Where possible, tuple comparison operators <,<=,=>, and > ought to be defined in terms of std::less rather than operator<, in order to support comparison of tuples of pointers.

History
Date User Action Args
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2010-10-21 18:28:33adminsetmessages: + msg2975
2010-10-21 18:28:33adminsetmessages: + msg2974
2010-10-21 18:28:33adminsetmessages: + msg2973
2010-10-21 18:28:33adminsetmessages: + msg2972
2010-10-21 18:28:33adminsetmessages: + msg2971
2010-10-21 18:28:33adminsetmessages: + msg2970
2005-11-29 00:00:00admincreate