$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-06 06:28:06
Martin Bonner wrote:
> I think specializing std::less<> for types that don't have a natural
> order is /exactly/ the right way to enable such types to be stored in
> an associative container.
map<K, V> will work when you have less<K>, but
map< pair<K, int>, V >
map< pair<K, K>, V >
map< vector<K>, V >
sort
lower_bound
will not.
> The algorithms are a different case. sort doesn't make sense for a
> type that doesn't have a natural order, and in that case the user
> needs to provide an appropriate comparison.
The combination of sort and lower_bound makes sense as a map replacement,
although specifying less<K>() here isn't hard.