14#ifndef RANGES_V3_ACTION_SLICE_HPP
15#define RANGES_V3_ACTION_SLICE_HPP
27#include <range/v3/utility/static_const.hpp>
30#include <range/v3/detail/prologue.hpp>
42 using diff_t = range_difference_t<D>;
48 constexpr auto operator()(D from, D to)
const
54 constexpr auto operator()(D from, detail::from_end_<D> to)
const
60 constexpr auto operator()(detail::from_end_<D> from, detail::from_end_<D> to)
67 constexpr auto operator()(D from, end_fn
const & to)
const
73 constexpr auto operator()(detail::from_end_<D> from, end_fn
const & to)
const
80 Rng operator()(Rng && rng, diff_t<Rng> from, diff_t<Rng> to)
const
82 RANGES_EXPECT(0 <= from && 0 <= to && from <= to);
84 ranges::actions::erase(rng, begin(rng), next(begin(rng), from));
85 ranges::actions::erase(rng, next(begin(rng), to - from), end(rng));
86 return static_cast<Rng &&
>(rng);
91 Rng operator()(Rng && rng,
93 detail::from_end_<diff_t<Rng>> to)
const
95 RANGES_EXPECT(0 <= from && to.dist_ <= 0);
97 ranges::actions::erase(rng, begin(rng), next(begin(rng), from));
100 auto const last = next(begin(rng), end(rng));
101 ranges::actions::erase(rng, prev(last, -to.dist_), last);
103 return static_cast<Rng &&
>(rng);
108 Rng operator()(Rng && rng,
109 detail::from_end_<diff_t<Rng>> from,
110 detail::from_end_<diff_t<Rng>> to)
const
112 RANGES_EXPECT(from.dist_ <= 0 && to.dist_ <= 0 && from.dist_ <= to.dist_);
114 auto last = next(begin(rng), end(rng));
115 ranges::actions::erase(rng, prev(last, -to.dist_), last);
116 last = next(begin(rng), end(rng));
117 ranges::actions::erase(
118 rng, begin(rng), prev(last, to.dist_ - from.dist_));
119 return static_cast<Rng &&
>(rng);
124 Rng operator()(Rng && rng, diff_t<Rng> from, end_fn
const &)
const
126 RANGES_EXPECT(0 <= from);
128 ranges::actions::erase(rng, begin(rng), next(begin(rng), from));
129 return static_cast<Rng &&
>(rng);
134 Rng operator()(Rng && rng,
135 detail::from_end_<diff_t<Rng>> from,
136 end_fn
const &)
const
138 RANGES_EXPECT(from.dist_ <= 0);
140 auto const last = next(begin(rng), end(rng));
141 ranges::actions::erase(rng, begin(rng), prev(last, -from.dist_));
142 return static_cast<Rng &&
>(rng);
152#include <range/v3/detail/epilogue.hpp>
The bidirectional_range concept.
The erasable_range concept.
The forward_range concept.
decltype(begin(declval(Rng &))) iterator_t
Definition: access.hpp:698
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector > >, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
defer< bind_back, Fn, Ts... > bind_back
Definition: meta.hpp:994