21#ifndef RANGES_V3_ALGORITHM_SEARCH_N_HPP
22#define RANGES_V3_ALGORITHM_SEARCH_N_HPP
38#include <range/v3/utility/static_const.hpp>
41#include <range/v3/detail/prologue.hpp>
51 template<
typename I,
typename S,
typename D,
typename V,
typename C,
typename P>
52 constexpr subrange<I> search_n_sized_impl(I
const begin_,
61 auto first = uncounted(begin_);
70 auto e = ranges::next(recounted(begin_, std::move(first), d_ - d),
86 return {recounted(begin_, std::move(first), d_ - d),
87 recounted(begin_, std::move(++m), d_ - d)};
93 first = next(std::move(m));
101 template<
typename I,
typename S,
typename D,
typename V,
typename C,
typename P>
102 constexpr subrange<I> search_n_impl(I first,
135 first = next(std::move(m));
144 RANGES_FUNC_BEGIN(search_n)
151 typename P = identity)(
152 requires forward_iterator<I> AND sentinel_for<S, I> AND
153 indirectly_comparable<I, V const *, C, P>)
154 constexpr subrange<I> RANGES_FUNC(search_n)(I
first,
156 iter_difference_t<I> cnt,
163 if(RANGES_CONSTEXPR_IF(sized_sentinel_for<S, I>))
164 return detail::search_n_sized_impl(std::move(first),
166 distance(first, last),
172 return detail::search_n_impl(
173 std::move(first), std::move(last), cnt, val, pred, proj);
177 template(
typename Rng,
typename V,
typename C =
equal_to,
typename P = identity)(
178 requires forward_range<Rng> AND
179 indirectly_comparable<iterator_t<Rng>, V
const *, C, P>)
180 constexpr borrowed_subrange_t<Rng> RANGES_FUNC(search_n)(Rng && rng,
181 iter_difference_t<iterator_t<Rng>> cnt,
187 return subrange<iterator_t<Rng>>{begin(rng), begin(rng)};
188 if(RANGES_CONSTEXPR_IF(sized_range<Rng>))
189 return detail::search_n_sized_impl(
190 begin(rng), end(rng), distance(rng), cnt, val, pred, proj);
192 return detail::search_n_impl(begin(rng), end(rng), cnt, val, pred, proj);
195 RANGES_FUNC_END(search_n)
199 using ranges::search_n;
204#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
bool_< T::type::value==U::type::value > equal_to
A Boolean integral constant wrapper around the result of comparing T::type::value and U::type::value ...
Definition meta.hpp:237