25 Algorithms library [algorithms]

25.4 Sorting and related operations [alg.sorting]

25.4.1 Sorting [alg.sort]

25.4.1.1 sort [sort]

template<class RandomAccessIterator> void sort(RandomAccessIterator first, RandomAccessIterator last); template<class RandomAccessIterator, class Compare> void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);

Effects: Sorts the elements in the range [first,last).

Requires: RandomAccessIterator shall satisfy the requirements of ValueSwappable ([swappable.requirements]). The type of *first shall satisfy the requirements of MoveConstructible (Table [moveconstructible]) and of MoveAssignable (Table [moveassignable]).

Complexity: Ο(Nlog(N)) (where N == last - first) comparisons.