Horizon
Loading...
Searching...
No Matches
adjacent_remove_if.hpp
Go to the documentation of this file.
1
2// Range v3 library
3//
4// Copyright Eric Niebler
5// Copyright Christopher Di Bella
6//
7// Use, modification and distribution is subject to the
8// Boost Software License, Version 1.0. (See accompanying
9// file LICENSE_1_0.txt or copy at
10// http://www.boost.org/LICENSE_1_0.txt)
11//
12// Project home: https://github.com/ericniebler/range-v3
13//
14#ifndef RANGES_V3_ACTION_ADJACENT_REMOVE_IF_HPP
15#define RANGES_V3_ACTION_ADJACENT_REMOVE_IF_HPP
16
17#include <utility>
18
20
27#include <range/v3/utility/static_const.hpp>
28
29#include <range/v3/detail/prologue.hpp>
30
31namespace ranges
32{
35 namespace actions
36 {
38 {
39 template(typename Pred, typename Proj = identity)(
40 requires (!range<Pred>))
41 constexpr auto operator()(Pred pred, Proj proj = {}) const
42 {
43 return make_action_closure(
44 bind_back(adjacent_remove_if_fn{}, std::move(pred), std::move(proj)));
45 }
46
47 template(typename Rng, typename Pred, typename Proj = identity)(
48 requires forward_range<Rng> AND
49 erasable_range<Rng, iterator_t<Rng>, sentinel_t<Rng>> AND
50 indirect_relation<Pred, projected<iterator_t<Rng>, Proj>> AND
52 Rng operator()(Rng && rng, Pred pred, Proj proj = {}) const
53 {
54 auto i = adjacent_remove_if(rng, std::move(pred), std::move(proj));
55 erase(rng, std::move(i), end(rng));
56 return static_cast<Rng &&>(rng);
57 }
58 };
59
61 RANGES_INLINE_VARIABLE(adjacent_remove_if_fn, adjacent_remove_if)
62 } // namespace actions
64} // namespace ranges
65
66#include <range/v3/detail/epilogue.hpp>
67
68#endif // RANGES_V3_ACTION_ADJACENT_REMOVE_IF_HPP
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
Definition adjacent_remove_if.hpp:38
Definition identity.hpp:25