All ordered containers (std::set
, std::map
, std::multiset
, std::multimap
) are, well, ordered. Non ordered containers (std::list
, std::vector
, std::deque
) can be ordered by providing a comparison function an using std::sort
(vector, deque) or by providing that comparator to a member method (list).
It all boils down to what you actually need. If you need to keep the elements sorted at all times, then a sorted container might be more efficient than modifying the container and resorting. On the other hand, if having the container sorted at all times is not a requirement, but being able to modify the elements then you might prefer a vector. Sorted containers maintain the keys as constant objects, as modification of the keys would break the sort invariant.
In some cases the container needs to be sorted at all times, but it does not change after some initialization phases. In that case a non-sorted container that gets sorted after initialization can be fine.