File indexing completed on 2025-12-16 10:27:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef RANGES_V3_ALGORITHM_IS_SORTED_HPP
0017 #define RANGES_V3_ALGORITHM_IS_SORTED_HPP
0018
0019 #include <utility>
0020
0021 #include <range/v3/range_fwd.hpp>
0022
0023 #include <range/v3/algorithm/is_sorted_until.hpp>
0024 #include <range/v3/functional/comparisons.hpp>
0025 #include <range/v3/functional/identity.hpp>
0026 #include <range/v3/iterator/concepts.hpp>
0027 #include <range/v3/utility/static_const.hpp>
0028
0029 #include <range/v3/detail/prologue.hpp>
0030
0031 namespace ranges
0032 {
0033
0034
0035 RANGES_FUNC_BEGIN(is_sorted)
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 template(typename I, typename S, typename R = less, typename P = identity)(
0049 requires forward_iterator<I> AND sentinel_for<S, I> AND
0050 indirect_strict_weak_order<R, projected<I, P>>)
0051 constexpr bool RANGES_FUNC(is_sorted)(I first, S last, R rel = R{}, P proj = P{})
0052 {
0053 return is_sorted_until(
0054 std::move(first), last, std::move(rel), std::move(proj)) == last;
0055 }
0056
0057
0058 template(typename Rng, typename R = less, typename P = identity)(
0059 requires forward_range<Rng> AND
0060 indirect_strict_weak_order<R, projected<iterator_t<Rng>, P>>)
0061 constexpr bool RANGES_FUNC(is_sorted)(Rng && rng, R rel = R{}, P proj = P{})
0062 {
0063 return (*this)(begin(rng), end(rng), std::move(rel), std::move(proj));
0064 }
0065
0066 RANGES_FUNC_END(is_sorted)
0067
0068 namespace cpp20
0069 {
0070 using ranges::is_sorted;
0071 }
0072
0073 }
0074
0075 #include <range/v3/detail/epilogue.hpp>
0076
0077 #endif