std::sort only works for random access iterators, but std::list only provides beeder iterators. Since it cannot be used with std::sort , it needs its own implementation, which can also be more optimized for a doubly linked list.
Similarly, you cannot use the std::map or std::set iterators with std::sort . But for this you do not need it, since they are always sorted.
As a side note, there is also std::map::find and the like. This is really not required since you can use all iterators with std::find . But functional versions of members provide optimized algorithms for individual containers, which are more efficient than std::find linear complexity.
Christian rau
source share