Horizon
Loading...
Searching...
No Matches
erase.hpp
Go to the documentation of this file.
1
2// Range v3 library
3//
4// Copyright Eric Niebler 2013-present
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
14#ifndef RANGES_V3_ACTION_ERASE_HPP
15#define RANGES_V3_ACTION_ERASE_HPP
16
17#include <utility>
18
20
22#include <range/v3/utility/static_const.hpp>
23
24#include <range/v3/detail/prologue.hpp>
25
26namespace ranges
27{
29 namespace adl_erase_detail
30 {
31 template(typename Cont, typename I, typename S)(
32 requires lvalue_container_like<Cont> AND forward_iterator<I> AND
33 sentinel_for<S, I>)
34 auto erase(Cont && cont, I first, S last) //
35 -> decltype(unwrap_reference(cont).erase(first, last))
36 {
37 return unwrap_reference(cont).erase(first, last);
38 }
39
40 struct erase_fn
41 {
42 template(typename Rng, typename I, typename S)(
43 requires range<Rng> AND forward_iterator<I> AND sentinel_for<S, I>)
44 auto operator()(Rng && rng, I first, S last) const
45 -> decltype(erase((Rng &&) rng, first, last))
46 {
47 return erase(static_cast<Rng &&>(rng), first, last);
48 }
49 };
50 } // namespace adl_erase_detail
52
54 RANGES_INLINE_VARIABLE(adl_erase_detail::erase_fn, erase)
55
56 namespace actions
57 {
58 using ranges::erase;
59 }
60
63 // clang-format off
66 template<typename Rng, typename I, typename S>
67 CPP_requires(erasable_range_,
68 requires(Rng && rng, I first, S last)
69 (
70 ranges::erase((Rng &&) rng, first, last)
71 )
72 );
75 template<typename Rng, typename I, typename S>
76 CPP_concept erasable_range =
77 range<Rng> && CPP_requires_ref(ranges::erasable_range_, Rng, I, S);
78 // clang-format on
80} // namespace ranges
81
82#include <range/v3/detail/epilogue.hpp>
83
84#endif
The erasable_range_ concept.