Horizon
Loading...
Searching...
No Matches
drop.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_DROP_HPP
15#define RANGES_V3_ACTION_DROP_HPP
16
18
25#include <range/v3/utility/static_const.hpp>
26
27#include <range/v3/detail/prologue.hpp>
28
29namespace ranges
30{
33 namespace actions
34 {
35 struct drop_fn
36 {
37 template(typename Int)(
38 requires detail::integer_like_<Int>)
39 constexpr auto operator()(Int n) const
40 {
41 RANGES_EXPECT(n >= Int(0));
42 return make_action_closure(bind_back(drop_fn{}, n));
43 }
44
45 template(typename Rng)(
46 requires forward_range<Rng> AND
48 Rng operator()(Rng && rng, range_difference_t<Rng> n) const
49 {
50 RANGES_EXPECT(n >= 0);
51 ranges::actions::erase(
52 rng, begin(rng), ranges::next(begin(rng), n, end(rng)));
53 return static_cast<Rng &&>(rng);
54 }
55 };
56
58 RANGES_INLINE_VARIABLE(drop_fn, drop)
59 } // namespace actions
61} // namespace ranges
62
63#include <range/v3/detail/epilogue.hpp>
64
65#endif
The erasable_range concept.
The forward_range concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
Definition drop.hpp:36