std::sort
only works for random access iterators, but a std::list
only provides biderectional iterators. Since it therefore cannot be used with std::sort
, it needs its own implementation, which is also likely to be more optimized for a doubly linked list.
Likewise you cannot use std::map
or std::set
iterators with std::sort
. But for these you don't need it anyway, as they are always sorted.
As a side note, there are also std::map::find
and the like. These are indeed not required, as you can use all iterators with std::find
. But the member function versions provide optimized algorithms for the individual containers, which are more efficient than std::find
's linear complexity.