|
Boost : |
From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-09-06 08:09:19
"Peter Dimov" <pdimov_at_[hidden]> writes:
[...]
| Another, more practical, argument is that if you specialize std::less, this
| will work:
|
| std::set< interval > s;
|
| std::vector< interval > v;
| std::sort(v.begin(), v.end(), less<interval>());
|
| but this (for example) will not:
|
| std::set< std::pair<interval, int> > s2;
Yes, but the problem isn't with interval. Is it?
| std::vector< interval > v;
| std::sort(v.begin(), v.end());
Again, this is a problem with std::less<> or interval.
Actually, I would -not-, by default, want the above to work
| std::less<> is just a function object "alias" of operator<.
That is untrue.
| So if you want sets of intervals to work (without an explicit comparator),
| provide an operator< that is a strict weak ordering.
Well, I don't find the example you provided convincing.
std::less<> is *not* just an alias for operator<.
-- Gaby
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk