partial_sort_copy

Syntax:

    #include <algorithm>
    iterator partial_sort_copy( iterator start, iterator end, iterator result_start, iterator result_end );
    iterator partial_sort_copy( iterator start, iterator end, iterator result_start, iterator result_end, StrictWeakOrdering cmp );

The partial_sort_copy() algorithm behaves like partial_sort(), except that instead of partially sorting the range in-place, a copy of the range is created and the sorting takes place in the copy. The initial range is defined by [start,end) and the location of the copy is defined by [result_start,result_end).

partial_sort_copy() returns an iterator to the end of the copied, partially- sorted range of elements.

Related Topics: binary_search, is_sorted, partial_sort, sort, stable_sort