14#ifndef RANGES_V3_VIEW_REMOVE_IF_HPP
15#define RANGES_V3_VIEW_REMOVE_IF_HPP
33#include <range/v3/utility/static_const.hpp>
37#include <range/v3/detail/prologue.hpp>
43 template<
typename Rng,
typename Pred>
46 is_finite<Rng>::value ? finite : range_cardinality<Rng>::value>
47 ,
private box<semiregular_box_t<Pred>>
51 : remove_if_view::view_adaptor{detail::move(rng)}
52 , remove_if_view::box(detail::move(pred))
70 RANGES_ASSERT(it != ranges::end(rng_->base()));
71 rng_->satisfy_forward(++it);
78 rng_->satisfy_reverse(it);
80 void advance() =
delete;
81 void distance_to() =
delete;
86 constexpr adaptor begin_adaptor()
92 constexpr auto end_adaptor()
const noexcept
99 constexpr auto end_adaptor()
110 auto const last = ranges::end(this->base());
111 auto & pred = this->remove_if_view::box::get();
112 while(it != last &&
invoke(pred, *it))
117 RANGES_ASSERT(begin_);
118 auto const &
first = *begin_;
119 auto & pred = this->remove_if_view::box::get();
122 RANGES_ASSERT(it !=
first);
125 }
while(
invoke(pred, *it));
128 constexpr void cache_begin()
132 auto it = ranges::begin(this->base());
134 begin_.emplace(std::move(it));
137 detail::non_propagating_cache<iterator_t<Rng>> begin_;
140#if RANGES_CXX_DEDUCTION_GUIDES >= RANGES_CXX_DEDUCTION_GUIDES_17
141 template(
typename Rng,
typename Pred)(
142 requires copy_constructible<Pred>)
153 template(
typename Rng,
typename Pred)(
162 template(
typename Rng,
typename Pred,
typename Proj)(
166 operator()(Rng && rng, Pred pred, Proj proj)
const
169 all(
static_cast<Rng &&
>(rng)),
170 compose(std::move(pred), std::move(proj))};
176 template<
typename Pred>
177 constexpr auto operator()(Pred pred)
const
181 template(
typename Pred,
typename Proj)(
183 constexpr auto operator()(Pred && pred, Proj proj)
const
193 using remove_if_base_fn::operator();
194 using remove_if_bind_fn::operator();
204#include <range/v3/detail/satisfy_boost_range.hpp>
207#include <range/v3/detail/epilogue.hpp>
The bidirectional_range concept.
The common_range concept.
The indirect_unary_predicate concept.
The viewable_range concept.
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: compose.hpp:33
Definition: remove_if.hpp:48
Definition: adaptor.hpp:475
Given a source range, unary predicate, and optional projection, present a view of the elements that d...
Definition: remove_if.hpp:152
Definition: remove_if.hpp:175
Definition: remove_if.hpp:192