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