This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Dup status.
Section: 19.4 [pairs] Status: Dup Submitter: Andy Sawyer Opened: 2001-10-23 Last modified: 2017-02-03
Priority: Not Prioritized
View all other issues in [pairs].
View all issues with Dup status.
Duplicate of: 532
The current wording of 20.2.2 [lib.pairs] p6 precludes the use of operator< on any pair type which contains a pointer.
In 19.4 [pairs] paragraph 6, replace:
Returns: x.first < y.first || (!(y.first < x.first) && x.second < y.second).
Returns: std::less<T1>()( x.first, y.first ) || (!std::less<T1>()( y.first, x.first) && std::less<T2>()( x.second, y.second ) )
This is an instance of a much more general problem. If we want operator< to translate to std::less for pairs of pointers, where do we draw the line? The same issue applies to individual pointers, smart pointer wrappers, std::vector<T*>, and so on.
Andy Koenig suggests that the real issue here is that we aren't distinguishing adequately between two different orderings, a "useful ordering" and a "canonical ordering" that's used just because we sometimes need some ordering without caring much which ordering it is. Another example of the later is typeinfo's before.