Horizon
Loading...
Searching...
No Matches
remove.hpp
Go to the documentation of this file.
1
2// Range v3 library
3//
4// Copyright Andrey Diduh 2019
5//
6// Use, modification and distribution is subject to the
7// Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// Project home: https://github.com/ericniebler/range-v3
12//
13#ifndef RANGES_V3_ACTION_REMOVE_HPP
14#define RANGES_V3_ACTION_REMOVE_HPP
15
16#include <meta/meta.hpp>
17
19
26#include <range/v3/utility/static_const.hpp>
27
28#include <range/v3/detail/prologue.hpp>
29
30namespace ranges
31{
34 namespace actions
35 {
36 struct remove_fn
37 {
38 template(typename V, typename P)(
39 requires (!range<V>))
40 constexpr auto operator()(V && value, P proj) const
41 {
42 return make_action_closure(
43 bind_back(remove_fn{}, static_cast<V &&>(value), std::move(proj)));
44 }
45
46 template<typename V>
47 constexpr auto operator()(V && value) const
48 {
49 return make_action_closure(
50 bind_back(remove_fn{}, static_cast<V &&>(value), identity{}));
51 }
52
53 template(typename Rng, typename V, typename P = identity)(
55 erasable_range<Rng, iterator_t<Rng>, sentinel_t<Rng>> AND
57 V const *>)
58 Rng operator()(Rng && rng, V const & value, P proj = {}) const
59 {
60 auto it = ranges::remove(rng, value, std::move(proj));
61 ranges::erase(rng, it, ranges::end(rng));
62 return static_cast<Rng &&>(rng);
63 }
64 };
65
67 RANGES_INLINE_VARIABLE(remove_fn, remove)
68 } // namespace actions
70} // namespace ranges
71
72#include <range/v3/detail/epilogue.hpp>
73
74#endif
The erasable_range concept.
The forward_range concept.
The indirect_relation concept.
The permutable concept.
The range concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
Tiny meta-programming library.
Definition remove.hpp:37
Definition comparisons.hpp:28
Definition identity.hpp:25