File indexing completed on 2025-01-18 10:09:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef RANGES_V3_ACTION_REMOVE_IF_HPP
0015 #define RANGES_V3_ACTION_REMOVE_IF_HPP
0016
0017 #include <utility>
0018
0019 #include <range/v3/range_fwd.hpp>
0020
0021 #include <range/v3/action/action.hpp>
0022 #include <range/v3/action/erase.hpp>
0023 #include <range/v3/algorithm/remove_if.hpp>
0024 #include <range/v3/functional/bind_back.hpp>
0025 #include <range/v3/functional/identity.hpp>
0026 #include <range/v3/range/traits.hpp>
0027 #include <range/v3/utility/static_const.hpp>
0028
0029 #include <range/v3/detail/prologue.hpp>
0030
0031 namespace ranges
0032 {
0033
0034
0035
0036
0037 namespace actions
0038 {
0039 struct remove_if_fn
0040 {
0041 template(typename C, typename P = identity)(
0042 requires (!range<C>))
0043 constexpr auto operator()(C pred, P proj = P{}) const
0044 {
0045 return make_action_closure(
0046 bind_back(remove_if_fn{}, std::move(pred), std::move(proj)));
0047 }
0048
0049 template(typename Rng, typename C, typename P = identity)(
0050 requires forward_range<Rng> AND
0051 erasable_range<Rng &, iterator_t<Rng>, iterator_t<Rng>> AND
0052 permutable<iterator_t<Rng>> AND
0053 indirect_unary_predicate<C, projected<iterator_t<Rng>, P>>)
0054 Rng operator()(Rng && rng, C pred, P proj = P{}) const
0055 {
0056 auto it = ranges::remove_if(rng, std::move(pred), std::move(proj));
0057 ranges::erase(rng, it, ranges::end(rng));
0058 return static_cast<Rng &&>(rng);
0059 }
0060 };
0061
0062
0063 RANGES_INLINE_VARIABLE(remove_if_fn, remove_if)
0064 }
0065
0066 }
0067
0068 #include <range/v3/detail/epilogue.hpp>
0069
0070 #endif