28 Algorithms library [algorithms]

28.7 Sorting and related operations [alg.sorting]

28.7.1 Sorting [alg.sort]

28.7.1.4 partial_­sort_­copy [partial.sort.copy]

template<class InputIterator, class RandomAccessIterator> RandomAccessIterator partial_sort_copy(InputIterator first, InputIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last); template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator> RandomAccessIterator partial_sort_copy(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last); template<class InputIterator, class RandomAccessIterator, class Compare> RandomAccessIterator partial_sort_copy(InputIterator first, InputIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp); template<class ExecutionPolicy, class ForwardIterator, class RandomAccessIterator, class Compare> RandomAccessIterator partial_sort_copy(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
Requires: RandomAccessIterator shall satisfy the requirements of ValueSwappable.
The type of *result_­first shall satisfy the requirements of MoveConstructible and of MoveAssignable.
Effects: Places the first min(last - first, result_­last - result_­first) sorted elements into the range [result_­first, result_­first + min(last - first, result_­last - result_­first)).
Returns: The smaller of: result_­last or result_­first + (last - first).
Complexity: Approximately (last - first) * log(min(last - first, result_­last - result_­first)) comparisons.