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

Description

Checked indexed range access.

Public Member Functions

template<typename Rng , requires = (RandomAccessRange<Rng>() && SizedRange<Rng>())>
auto operator() (Rng &&rng, range_difference_type_t< Rng > n) const -> decltype(ranges::begin(rng)[n])
 
template<typename Rng , requires = (RandomAccessRange<Rng>() && !SizedRange<Rng>())>
auto operator() (Rng &&rng, range_difference_type_t< Rng > n) const noexcept(noexcept(decltype(index(std::forward< Rng >(rng), n))(index(std::forward< Rng >(rng), n)))) -> decltype(index(std::forward< Rng >(rng), n))
 
template<typename Rng , typename T , typename Self = at_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/3]

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

References ranges::v3::begin.

◆ operator()() [2/3]

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

◆ operator()() [3/3]

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