Created on 2001-10-23.00:00:00 last changed 171 months ago
Rationale:
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.
Proposed resolution:
In [pairs] paragraph 6, replace:
Returns: x.first < y.first || (!(y.first < x.first) && x.second < y.second).
With:
Returns: std::less<T1>()( x.first, y.first ) || (!std::less<T1>()( y.first, x.first) && std::less<T2>()( x.second, y.second ) )
Duplicate: 532
The current wording of 20.2.2 [lib.pairs] p6 precludes the use of operator< on any pair type which contains a pointer.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2312 |
2010-10-21 18:28:33 | admin | set | messages: + msg2311 |
2001-10-23 00:00:00 | admin | create |