Topic: Defect Report: Insufficient requirements for tuple::operator<()


Author: Joe Gottman <josephgottman@comcast.net>
Date: Sat, 15 May 2010 20:17:31 CST
Raw View
The requirements section for std::tuple says the following:
   Requires: For all i, where 0 <= i and i < sizeof...(Types),
get<i>(t) < get<i>(u) is a valid
expression returning a type that is convertible to bool.
sizeof...(TTypes) == sizeof...(UTypes).

This is necessary but not sufficient, as the algorithm for comparing
tuples also computes get<i>(u) < get<i>(t) (note the order)

Proposed Resolution: Change the requirements section to say

  Requires: For all i, where 0 <= i and i < sizeof...(Types),
get<i>(t) < get<i>(u) and get<i>(u) < get<i>(t) are valid
expressions returning types that are convertible to bool.
sizeof...(TTypes) == sizeof...(UTypes).

Joe Gottman

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]