15 #ifndef RANGES_V3_RANGE_OPERATIONS_HPP
16 #define RANGES_V3_RANGE_OPERATIONS_HPP
26 #include <range/v3/utility/static_const.hpp>
28 #include <range/v3/detail/prologue.hpp>
38 template(
typename Rng)(
39 requires random_access_range<Rng> AND sized_range<Rng> AND
41 constexpr range_reference_t<Rng>
42 operator()(Rng && rng, range_difference_t<Rng> n)
const
46 return ranges::begin(rng)[n];
50 template<
typename Rng>
51 static constexpr
void check_throw(Rng && rng, range_difference_t<Rng> n)
53 (n < 0 || n >= ranges::distance(rng)) ?
throw std::out_of_range(
"ranges::at")
70 template(
typename Rng,
typename Int)(
71 requires random_access_range<Rng> AND integral<Int> AND borrowed_range<Rng>)
72 constexpr range_reference_t<Rng> operator()(Rng && rng, Int n)
const
74 using D = range_difference_t<Rng>;
75 RANGES_EXPECT(0 <=
static_cast<D
>(n));
76 RANGES_EXPECT(!(
bool)sized_range<Rng> ||
77 static_cast<D
>(n) < ranges::distance(rng));
78 return ranges::begin(rng)[
static_cast<D
>(n)];
92 template(
typename Rng)(
93 requires common_range<Rng> AND bidirectional_range<Rng> AND
95 constexpr range_reference_t<Rng> operator()(Rng && rng)
const
97 return *prev(end(rng));
109 template(
typename Rng)(
110 requires forward_range<Rng> AND borrowed_range<Rng>)
111 constexpr range_reference_t<Rng> operator()(Rng && rng)
const
122 #include <range/v3/detail/epilogue.hpp>
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
_t< detail::back_< L > > back
Return the last element in meta::list L.
Definition: meta.hpp:2103
at_c< L, N::type::value > at
Return the N th element in the meta::list L.
Definition: meta.hpp:1969
_t< detail::front_< L > > front
Return the first element in meta::list L.
Definition: meta.hpp:2070
Checked indexed range access.
Definition: operations.hpp:36
Unchecked indexed range access.
Definition: operations.hpp:90
Definition: operations.hpp:107
Checked indexed range access.
Definition: operations.hpp:68