1335. Insufficient requirements for tuple::operator<()

Section: 23.5.3.8 [tuple.rel] Status: C++11 Submitter: Joe Gottman Opened: 2010-05-15 Last modified: 2016-02-10

Priority: Not Prioritized

View other active issues in [tuple.rel].

View all other issues in [tuple.rel].

View all issues with C++11 status.

Discussion:

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)

[ Post-Rapperswil ]

Moved to Tentatively Ready with updated wording correcting change-bars after 6 positive votes on c++std-lib.

[ Adopted at 2010-11 Batavia ]

Proposed resolution:

  1. Change [tuple.rel] before p. 4 as indicated [Remark to the editor: This paragraph doesn't have a number yet, but it seems to me as if it should have one]:
    template<class... TTypes, class... UTypes>
    bool operator<(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
    

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