22#ifndef RANGES_V3_ALGORITHM_PARTITION_POINT_HPP
23#define RANGES_V3_ALGORITHM_PARTITION_POINT_HPP
39#include <range/v3/utility/static_const.hpp>
41#include <range/v3/detail/prologue.hpp>
48 RANGES_FUNC_BEGIN(partition_point)
51 template(
typename I,
typename S,
typename C,
typename P = identity)(
52 requires forward_iterator<I> AND sentinel_for<S, I> AND
53 indirect_unary_predicate<C, projected<I, P>>)
54 constexpr I RANGES_FUNC(partition_point)(I
first, S last, C pred, P proj = P{})
56 if(RANGES_CONSTEXPR_IF(sized_sentinel_for<S, I>))
58 auto len = distance(first, std::move(last));
59 return aux::partition_point_n(
60 std::move(first), len, std::move(pred), std::move(proj));
65 auto len = iter_difference_t<I>{1};
69 auto d = advance(mid, len, last);
73 return aux::partition_point_n(
74 std::move(first), len, ranges::ref(pred), ranges::ref(proj));
76 first = std::move(mid);
82 template(
typename Rng,
typename C,
typename P = identity)(
83 requires forward_range<Rng> AND
84 indirect_unary_predicate<C, projected<iterator_t<Rng>, P>>)
85 constexpr borrowed_iterator_t<Rng>
86 RANGES_FUNC(partition_point)(Rng && rng, C pred, P proj = P{})
88 if(RANGES_CONSTEXPR_IF(sized_range<Rng>))
90 auto len = distance(rng);
91 return aux::partition_point_n(
92 begin(rng), len, std::move(pred), std::move(proj));
94 return (*
this)(begin(rng), end(rng), std::move(pred), std::move(proj));
97 RANGES_FUNC_END(partition_point)
101 using ranges::partition_point;
106#include <range/v3/detail/epilogue.hpp>
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition meta.hpp:541
front< Pair > first
Retrieve the first element of the pair Pair.
Definition meta.hpp:2251