14 #ifndef RANGES_V3_VIEW_ADJACENT_FILTER_HPP
15 #define RANGES_V3_VIEW_ADJACENT_FILTER_HPP
28 #include <range/v3/utility/static_const.hpp>
32 #include <range/v3/detail/prologue.hpp>
42 template(
typename Rng,
typename Pred)(
43 concept (adjacent_filter_constraints_)(Rng, Pred),
48 template<
typename Rng,
typename Pred>
49 CPP_concept adjacent_filter_constraints =
50 viewable_range<Rng> && forward_range<Rng> &&
51 CPP_concept_ref(detail::adjacent_filter_constraints_, Rng, Pred);
58 template<
typename Rng,
typename Pred>
71 friend struct adaptor<!Const>;
72 using CRng = meta::const_if_c<Const, Rng>;
73 using Parent = meta::const_if_c<Const, adjacent_filter_view>;
78 constexpr adaptor(Parent * rng) noexcept
82 requires Const && CPP_NOT(Other))
83 constexpr adaptor(adaptor<Other> that)
88 auto const last = ranges::end(rng_->base());
89 auto & pred = rng_->adjacent_filter_view::box::get();
90 RANGES_EXPECT(it != last);
91 for(
auto tmp = it; ++it != last; tmp = it)
92 if(
invoke(pred, *tmp, *it))
98 requires bidirectional_range<CRng>)
100 auto const first = ranges::begin(rng_->base());
101 auto & pred = rng_->adjacent_filter_view::box::get();
102 RANGES_EXPECT(it !=
first);
107 if(
invoke(pred, *--tmp, *it))
112 void distance_to() =
delete;
114 constexpr adaptor<false> begin_adaptor() noexcept
119 constexpr
auto begin_adaptor()
const noexcept
120 -> CPP_ret(adaptor<true>)(
121 requires detail::adjacent_filter_constraints<Rng const, Pred const>)
125 constexpr adaptor<false> end_adaptor() noexcept
130 constexpr
auto end_adaptor()
const noexcept
131 -> CPP_ret(adaptor<true>)(
132 requires detail::adjacent_filter_constraints<Rng const, Pred const>)
140 : adjacent_filter_view::view_adaptor{detail::move(rng)}
141 , adjacent_filter_view::box(detail::move(pred))
145 #if RANGES_CXX_DEDUCTION_GUIDES >= RANGES_CXX_DEDUCTION_GUIDES_17
146 template(
typename Rng,
typename Fun)(
147 requires copy_constructible<Rng>)
149 ->adjacent_filter_view<views::all_t<Rng>, Fun>;
156 template(
typename Rng,
typename Pred)(
157 requires detail::adjacent_filter_constraints<Rng, Pred>)
159 operator()(Rng && rng, Pred pred)
const
161 return {all(
static_cast<Rng &&
>(rng)), std::move(pred)};
167 using adjacent_filter_base_fn::operator();
169 template<
typename Pred>
170 constexpr
auto operator()(Pred pred)
const
172 return make_view_closure(
184 #include <range/v3/detail/epilogue.hpp>
186 #include <range/v3/detail/satisfy_boost_range.hpp>
CPP_concept indirect_binary_predicate_
\concept indirect_binary_predicate_
Definition: concepts.hpp:651
decltype(begin(declval(Rng &))) iterator_t
Definition: access.hpp:698
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector >>, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition: meta.hpp:541
defer< bind_back, Fn, Ts... > bind_back
Definition: meta.hpp:994
front< Pair > first
Retrieve the first element of the pair Pair.
Definition: meta.hpp:2251
Definition: adaptor.hpp:110
Definition: adjacent_filter.hpp:63
Definition: traits.hpp:128
Definition: adaptor.hpp:475
Definition: adjacent_filter.hpp:155
Definition: adjacent_filter.hpp:166