21#ifndef RANGES_V3_ALGORITHM_SEARCH_HPP
22#define RANGES_V3_ALGORITHM_SEARCH_HPP
38#include <range/v3/utility/static_const.hpp>
41#include <range/v3/detail/prologue.hpp>
51 template<
typename I1,
typename S1,
typename D1,
typename I2,
typename S2,
52 typename D2,
typename C,
typename P1,
typename P2>
53 constexpr subrange<I1> search_sized_impl(I1
const begin1_,
64 auto begin1 = uncounted(begin1_);
74 ranges::next(recounted(begin1_, std::move(begin1), d1_ - d1),
91 return {recounted(begin1_, std::move(begin1), d1_ - d1),
92 recounted(begin1_, std::move(++m1), d1_ - d1)};
110 template<
typename I1,
typename S1,
typename I2,
typename S2,
typename C,
111 typename P1,
typename P2>
112 constexpr subrange<I1> search_impl(I1 begin1,
127 return {begin1, begin1};
139 return {begin1, ++m1};
158 RANGES_FUNC_BEGIN(search)
161 template(
typename I1,
166 typename P1 = identity,
167 typename P2 = identity)(
168 requires forward_iterator<I1> AND sentinel_for<S1, I1> AND
169 forward_iterator<I2> AND sentinel_for<S2, I2> AND
170 indirectly_comparable<I1, I2, C, P1, P2>)
171 constexpr subrange<I1> RANGES_FUNC(search)(I1 begin1,
180 return {begin1, begin1};
181 if(RANGES_CONSTEXPR_IF(sized_sentinel_for<S1, I1> &&
182 sized_sentinel_for<S2, I2>))
183 return detail::search_sized_impl(std::move(begin1),
185 distance(begin1, end1),
188 distance(begin2, end2),
193 return detail::search_impl(std::move(begin1),
203 template(
typename Rng1,
206 typename P1 = identity,
207 typename P2 = identity)(
208 requires forward_range<Rng1> AND forward_range<Rng2> AND
209 indirectly_comparable<iterator_t<Rng1>, iterator_t<Rng2>, C, P1, P2>)
210 constexpr borrowed_subrange_t<Rng1> RANGES_FUNC(search)(
211 Rng1 && rng1, Rng2 && rng2, C pred = C{}, P1 proj1 = P1{}, P2 proj2 = P2{})
214 return subrange<iterator_t<Rng1>>{begin(rng1), begin(rng1)};
215 if(RANGES_CONSTEXPR_IF(sized_range<Rng1> && sized_range<Rng2>))
216 return detail::search_sized_impl(begin(rng1),
226 return detail::search_impl(
227 begin(rng1), end(rng1), begin(rng2), end(rng2), pred, proj1, proj2);
230 RANGES_FUNC_END(search)
234 using ranges::search;
239#include <range/v3/detail/epilogue.hpp>
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition meta.hpp:541
bool_< 0==size< L >::type::value > empty
An Boolean integral constant wrapper around true if L is an empty type list; false,...
Definition meta.hpp:2231
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