There is a sort() method for lists in STL. Which is absurd, because I would be more inclined to sort an array/vector. Why isn\'t sort() provided for vector? Is there some un
std::sort() in
does sorting on containers with random access iterators like std::vector
.
There is also std::stable_sort().
edit - why does std::list
have its own sort()
function versus std::vector
?
std::list
is different from both std::vector
and std::deque
(both random access iterable) in how it's implemented, so it contains its own sort
algorithm that is specialized for its implementation.