Sorting items

The sequence containers can be sorted, and once you have done this you can use methods to search for items, to merge containers, or to get the difference between the containers. The sort function will order the items in a range according to the < operator or a predicate that you provide. If there are items that are equal in the range, then the order of these items after the sort is not guaranteed; if this order is important, you should call the stable_sort function instead. If you want to preserve the input range and copy the sorted items into another range, you use the confusingly named partial_sort_copy function. This is not a partial sort. This function is passed iterators to the input range and iterators for the output range, ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.