Created on 2008-10-28.00:00:00 last changed 172 months ago
Proposed resolution:
In [tuple.general] and [tuple.rel] change:
template<class... TTypes, class... UTypes> requiresEqualityComparableHasEqualTo<TTypes, UTypes>... bool operator==(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, class... UTypes> requiresLessThanComparableHasLess<TTypes, UTypes>... && HasLess<UTypes, TTypes>... bool operator<(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, class... UTypes> requiresEqualityComparableHasEqualTo<TTypes, UTypes>... bool operator!=(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, class... UTypes> requiresLessThanComparableHasLess<UTTypes,TUTypes>... && HasLess<UTypes, TTypes>... bool operator>(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, class... UTypes> requiresLessThanComparableHasLess<UTTypes,TUTypes>... && HasLess<UTypes, TTypes>... bool operator<=(const tuple<TTypes...>&, const tuple<UTypes...>&); template<class... TTypes, class... UTypes> requiresLessThanComparableHasLess<TTypes, UTypes>... && HasLess<UTypes, TTypes>... bool operator>=(const tuple<TTypes...>&, const tuple<UTypes...>&);
[ Post Summit: ]
Recommend Tentatively Ready.
In the latest working draft for C++0x, tuple's operator== and operator< are declared as
template<class... TTypes, class... UTypes> requires EqualityComparable<TTypes, UTypes>... bool operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
and
template<class... TTypes, class... UTypes> requires LessThanComparable<TTypes, UTypes>... bool operator<(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
But the concepts EqualityComparable and LessThanComparable only take one parameter, not two. Also, even if LessThanComparable could take two parameters, the definition of tuple::operator<() should also require
LessThanComparable<UTypes, TTypes>... // (note the order)
since the algorithm for tuple::operator< is the following (pseudo-code)
for (size_t N = 0; N < sizeof...(TTypes); ++N) { if (get<N>(t) < get<N>(u) return true; else if ((get<N>(u) < get<N>(t)) return false; } return false;
Similar problems hold for tuples's other comparison operators.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg4409 |
2010-10-21 18:28:33 | admin | set | messages: + msg4408 |
2008-10-28 00:00:00 | admin | create |