std::sort() works with random-access iterators, which means it can be used with containers that provide random access to their elements. The most common containers that std::sort() works with include:
std::vector: A dynamic array that allows random access.std::deque: A double-ended queue that also supports random access.- Arrays: Both built-in arrays and
std::array.
It does not work with containers like std::list or std::forward_list, as they do not provide random access iterators.
