Range-v3
Range algorithms, views, and actions for the Standard Library
ranges::v3::index_fn Struct Reference

Description

Unchecked indexed range access.

Public Member Functions

template<typename Rng , requires = (RandomAccessRange<Rng>())>
auto operator() (Rng &&rng, range_difference_type_t< Rng > n) const noexcept(noexcept(ranges::begin(rng)[n]) &&noexcept(n< ranges::distance(rng))) -> decltype(ranges::begin(rng)[n])
 
template<typename Rng , typename T , typename Self = index_fn, typename D = range_difference_type_t<Rng>, requires = (RandomAccessRange<Rng>() && !Same<uncvref_t<T>, D>() && ConvertibleTo<T, D>())>
auto operator() (Rng &&rng, T &&t) const noexcept(noexcept(decltype(Self{}((Rng &&) rng, static_cast< D >((T &&) t)))(Self{}((Rng &&) rng, static_cast< D >((T &&) t))))) -> decltype(Self
 
Rng static_cast ((T &&) t)))
 

Public Attributes

Rng && rng
 

Member Function Documentation

◆ operator()() [1/2]

template<typename Rng , requires = (RandomAccessRange<Rng>())>
auto ranges::v3::index_fn::operator() ( Rng &&  rng,
range_difference_type_t< Rng >  n 
) )[n] const -> decltype(ranges::begin(rng)[n])
noexcept
Returns
begin(rng)[n]

References ranges::v3::begin, and ranges::v3::distance.

◆ operator()() [2/2]

template<typename Rng , typename T , typename Self = index_fn, typename D = range_difference_type_t<Rng>, requires = (RandomAccessRange<Rng>() && !Same<uncvref_t<T>, D>() && ConvertibleTo<T, D>())>
auto ranges::v3::index_fn::operator() ( Rng &&  rng,
T &&  t 
) const -> decltype( Self
noexcept
Returns
begin(rng)[n]