Daily bit(e) of C++ | std::is_sorted, std::is_sorted_until
Daily bit(e) of C++ #228, The two algorithms that check whether a range is sorted in non-ascending order: std::is_sorted, std::is_sorted_until.
The C++11 std::is_sorted, and std::is_sorted_until algorithms verify that the provided range is sorted in non-descending order (using the operator< or a comparator).
The std::is_sorted algorithm returns a boolean; the std::is_sorted_until returns an iterator to the first out-of-order element.
Both algorithms provide parallel (C++17), constexpr (C++20) and range versions (C++20).