tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_sorted.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_IS_SORTED_HPP
4#define TETL_ALGORITHM_IS_SORTED_HPP
5
7
8namespace etl {
9
12template <typename ForwardIt>
13[[nodiscard]] constexpr auto is_sorted(ForwardIt first, ForwardIt last) -> bool
14{
15 return etl::is_sorted_until(first, last) == last;
16}
17
19template <typename ForwardIt, typename Compare>
20[[nodiscard]] constexpr auto is_sorted(ForwardIt first, ForwardIt last, Compare comp) -> bool
21{
22 return etl::is_sorted_until(first, last, comp) == last;
23}
24
25} // namespace etl
26
27#endif // TETL_ALGORITHM_IS_SORTED_HPP
constexpr auto is_sorted(ForwardIt first, ForwardIt last) -> bool
Checks if the elements in range [first, last) are sorted in non-descending order.
Definition is_sorted.hpp:13
constexpr auto is_sorted_until(ForwardIt first, ForwardIt last, Compare comp) -> ForwardIt
Definition is_sorted_until.hpp:11
Definition adjacent_find.hpp:8