stl:algorithm:is_sorted

C++ Reference

is_sorted

Syntax:

    #include <algorithm>
    bool is_sorted( iterator start, iterator end );
    bool is_sorted( iterator start, iterator end, StrictWeakOrdering cmp );

The is_sorted() algorithm returns true if the elements in the range [start,end) are sorted in ascending order.

By default, the < operator is used to compare elements. If the strict weak order function object cmp is given, then it is used instead.

is_sorted() runs in linear time.

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