Possible Duplicate:
Sort list using stl sort function
The C++ standard library gives strict linear sequence container, linear sequence container, associative container.
std::sort() is available for all kinds of containers. But why only it provides sort for list. std::list::sort()?
std::sortonly works on random access containers. And the only non-random access container in the standard library that it makes sense to sort isstd::list.std::sortcertainly doesn’t work on associative containers as you seem to think. What sense would that make? Associative containers are accessed by the value of their key, not by position.As noted by Mike, C++11 also has
std::forward_list, which, by no accident, also has it’s own sort function.