Range-v3
Range algorithms, views, and actions for the Standard Library
Range

Description

Core range functionality.

Modules

 Range Concepts
 Range concepts.
 

Classes

struct  ranges::at_fn
 Checked indexed range access. More...
 
struct  ranges::back_fn
 
struct  ranges::bidirectional_range_tag
 
struct  ranges::common_range_tag
 
struct  ranges::contiguous_range_tag
 
struct  ranges::dangling
 A placeholder for an iterator or a sentinel into a range that may no longer be valid. More...
 
struct  ranges::forward_range_tag
 
struct  ranges::front_fn
 
struct  ranges::index_fn
 Unchecked indexed range access. More...
 
struct  ranges::input_range_tag
 
struct  ranges::random_access_range_tag
 
struct  ranges::range_cardinality< Rng, Void >
 
struct  ranges::range_tag
 
struct  ranges::sized_range_tag
 

Typedefs

template<typename I , typename S >
using ranges::common_iterator_t = detail::if_then_t< std::is_same< I, S >::value, I, detail::common_iterator_impl_t< I, S > >
 
template<typename Rng >
using ranges::common_range_tag_of = std::enable_if_t< range< Rng >, detail::if_then_t< common_range< Rng >, common_range_tag, range_tag > >
 
template<typename Rng >
using ranges::range_common_iterator_t = common_iterator_t< iterator_t< Rng >, sentinel_t< Rng > >
 
template<typename Rng >
using ranges::range_common_reference_t = iter_common_reference_t< iterator_t< Rng > >
 
template<typename Rng >
using ranges::range_difference_t = iter_difference_t< iterator_t< Rng > >
 
template<typename Rng >
using ranges::range_reference_t = iter_reference_t< iterator_t< Rng > >
 
template<typename Rng >
using ranges::range_rvalue_reference_t = iter_rvalue_reference_t< iterator_t< Rng > >
 
template<typename Rng >
using ranges::range_size_t = decltype(ranges::size(std::declval< Rng & >()))
 
template<typename Rng >
using ranges::range_tag_of = std::enable_if_t< range< Rng >, detail::if_then_t< contiguous_range< Rng >, contiguous_range_tag, detail::if_then_t< random_access_range< Rng >, random_access_range_tag, detail::if_then_t< bidirectional_range< Rng >, bidirectional_range_tag, detail::if_then_t< forward_range< Rng >, forward_range_tag, detail::if_then_t< input_range< Rng >, input_range_tag, range_tag > >> >> >
 
template<typename Rng >
using ranges::range_value_t = iter_value_t< iterator_t< Rng > >
 
template<typename Rng >
using ranges::sized_range_tag_of = std::enable_if_t< range< Rng >, detail::if_then_t< sized_range< Rng >, sized_range_tag, range_tag > >
 

Functions

template<template< typename... > class ContT>
auto ranges::to () -> detail::to_container_fn< detail::from_range< ContT >>
 For initializing a container of the specified type with the elements of an Range. More...
 
template<template< typename... > class ContT, typename Rng >
auto ranges::to (Rng &&rng) -> ContT< range_value_t< Rng >> requires range< Rng > &&detail::convertible_to_cont< Rng, ContT< range_value_t< Rng >>>
 

Variables

constexpr at_fn ranges::at {}
 Checked indexed range access. More...
 
constexpr back_fn ranges::back {}
 
constexpr _begin_::fn ranges::begin {}
 
template<typename T >
concept ranges::bidirectional_range
 
template<typename T >
concept ranges::bidirectional_range_ = bidirectional_iterator<iterator_t<T>>
 
constexpr _cbegin_::fn ranges::cbegin {}
 
constexpr _cdata_::fn ranges::cdata {}
 
constexpr _cend_::fn ranges::cend {}
 
template<typename T >
concept ranges::common_range
 
template<typename T >
concept ranges::common_range_ = same_as<iterator_t<T>, sentinel_t<T>>
 
template<typename T >
concept ranges::container
 
template<typename T >
concept ranges::contiguous_range
 
template<typename T >
concept ranges::contiguous_range_ = contiguous_iterator<iterator_t<T>> && same_as<detail::data_t<T>, std::add_pointer_t<iter_reference_t<iterator_t<T>>>>
 
constexpr _crbegin_::fn ranges::crbegin {}
 
constexpr _crend_::fn ranges::crend {}
 
constexpr _empty_::fn ranges::empty {}
 
template<typename T >
constexpr bool ranges::enable_view
 
constexpr _end_::fn ranges::end {}
 
template<typename Rng , typename I , typename S >
concept ranges::erasable_range
 
template<typename T >
concept ranges::forward_range
 
template<typename T >
concept ranges::forward_range_ = forward_iterator<iterator_t<T>>
 
template<typename T >
concept ranges::forwarding_range_
 
constexpr front_fn ranges::front {}
 
constexpr index_fn ranges::index {}
 Unchecked indexed range access. More...
 
template<typename T >
concept ranges::input_range
 
template<typename T >
concept ranges::input_range_ = input_iterator<iterator_t<T>>
 
template<typename T >
concept ranges::lvalue_container_like
 
template<typename T >
concept ranges::lvalue_container_like_ = implicitly_convertible_to<detail::is_lvalue_container_like_t<T>, std::true_type>
 
template<typename T , typename V >
concept ranges::output_range
 
template<typename T , typename V >
concept ranges::output_range_ = output_iterator<iterator_t<T>, V>
 
template<typename T >
concept ranges::random_access_range
 
template<typename T >
concept ranges::random_access_range_ = random_access_iterator<iterator_t<T>>
 
template<typename C >
concept ranges::random_access_reservable
 
template<typename T >
concept ranges::range
 
template<typename T >
concept ranges::range_impl_
 Range concepts below. More...
 
constexpr _rbegin_::fn ranges::rbegin {}
 
constexpr _rend_::fn ranges::rend {}
 
template<typename C >
concept ranges::reservable
 
template<typename C , typename I >
concept ranges::reservable_with_assign
 
template<typename T >
concept ranges::semi_container
 
constexpr _size_::fn ranges::size {}
 
template<typename T >
concept ranges::sized_range
 
template<typename T >
concept ranges::sized_range_ = detail::integer_like_<range_size_t<T>>
 
constexpr detail::to_container_fn< detail::from_range< std::vector > > ranges::to_vector {}
 
template<typename T >
concept ranges::view_
 View concepts below. More...
 
template<typename T >
concept ranges::viewable_range
 

Function Documentation

◆ to() [1/2]

template<template< typename... > class ContT>
auto ranges::to ( ) -> detail::to_container_fn< meta::id< Cont >>

#include <range/v3/range/conversion.hpp>

For initializing a container of the specified type with the elements of an Range.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ to() [2/2]

template<template< typename... > class ContT, typename Rng >
auto ranges::to ( Rng &&  rng) -> ContT<range_value_t<Rng>> requires range<Rng> && detail::convertible_to_cont<Rng, ContT<range_value_t<Rng>>>

#include <range/v3/range/conversion.hpp>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Variable Documentation

◆ at

constexpr at_fn ranges::at {}

#include <range/v3/range/operations.hpp>

Checked indexed range access.

See also
at_fn

◆ back

constexpr back_fn ranges::back {}

◆ begin

constexpr _begin_::fn ranges::begin {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
r, if r is an array. Otherwise, r.begin() if that expression is well-formed and returns an input_or_output_iterator. Otherwise, begin(r) if that expression returns an input_or_output_iterator.

◆ bidirectional_range

template<typename T >
concept ranges::bidirectional_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
forward_range<T> && ranges::bidirectional_range_ < T >

◆ cbegin

constexpr _cbegin_::fn ranges::cbegin {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
The result of calling ranges::begin with a const-qualified reference to r.

◆ cdata

constexpr _cdata_::fn ranges::cdata {}

#include <range/v3/range/primitives.hpp>

Parameters
r
Returns
The result of calling ranges::data with a const-qualified (lvalue or rvalue) reference to r.

◆ cend

constexpr _cend_::fn ranges::cend {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
The result of calling ranges::end with a const-qualified reference to r.

◆ common_range

template<typename T >
concept ranges::common_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> && ranges::common_range_ < T >

◆ container

template<typename T >
concept ranges::container

#include <range/v3/action/concepts.hpp>

Initial value:
=
semi_container<T> &&
constructible_from<
uncvref_t<T>,
detail::movable_input_iterator<range_value_t<T>>,
detail::movable_input_iterator<range_value_t<T>>>

◆ contiguous_range

template<typename T >
concept ranges::contiguous_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
random_access_range<T> && ranges::contiguous_range_ < T >

◆ crbegin

constexpr _crbegin_::fn ranges::crbegin {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
The result of calling ranges::rbegin with a const-qualified reference to r.

◆ crend

constexpr _crend_::fn ranges::crend {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
The result of calling ranges::rend with a const-qualified reference to r.

◆ empty

constexpr _empty_::fn ranges::empty {}

#include <range/v3/range/primitives.hpp>

Returns
true if and only if range contains no elements.

◆ enable_view

template<typename T >
constexpr bool ranges::enable_view

#include <range/v3/range/concepts.hpp>

Initial value:
=
detail::enable_view_impl_(detail::nullptr_<T>(0))

◆ end

constexpr _end_::fn ranges::end {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
r+size(r), if r is an array. Otherwise, r.end() if that expression is well-formed and returns an input_or_output_iterator. Otherwise, end(r) if that expression returns an input_or_output_iterator.

◆ erasable_range

template<typename Rng , typename I , typename S >
concept ranges::erasable_range

#include <range/v3/action/erase.hpp>

Initial value:
=
range<Rng> && requires( Rng && rng , I first , S last )
(
ranges::erase(((decltype( rng )&&) rng ), first, last)
)
front< Pair > first
Retrieve the first element of the pair Pair.
Definition: meta.hpp:2219
requires(sizeof...(Ts) > 0) using lambda
For creating anonymous Invocables.

◆ forward_range

template<typename T >
concept ranges::forward_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
input_range<T> && ranges::forward_range_ < T >

◆ forwarding_range_

template<typename T >
concept ranges::forwarding_range_

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> && range_impl_<T>

◆ front

constexpr front_fn ranges::front {}

◆ index

constexpr index_fn ranges::index {}

#include <range/v3/range/operations.hpp>

Unchecked indexed range access.

See also
index_fn

◆ input_range

template<typename T >
concept ranges::input_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> && ranges::input_range_ < T >

◆ lvalue_container_like

template<typename T >
concept ranges::lvalue_container_like

#include <range/v3/action/concepts.hpp>

Initial value:
=
forward_range<T> &&
ranges::lvalue_container_like_ < T >

◆ output_range

template<typename T , typename V >
concept ranges::output_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> && ranges::output_range_ < T, V >

◆ random_access_range

template<typename T >
concept ranges::random_access_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
bidirectional_range<T> && ranges::random_access_range_ < T >

◆ random_access_reservable

template<typename C >
concept ranges::random_access_reservable

#include <range/v3/action/concepts.hpp>

Initial value:
=
reservable<C> && random_access_range<C>

◆ range

template<typename T >
concept ranges::range

#include <range/v3/range/concepts.hpp>

Initial value:
=
range_impl_<T &>

◆ range_impl_

template<typename T >
concept ranges::range_impl_

#include <range/v3/range/concepts.hpp>

Initial value:
=
requires( T && t )
(
ranges::begin(((decltype( t )&&) t )),
ranges::end(((decltype( t )&&) t ))
)
requires(sizeof...(Ts) > 0) using lambda
For creating anonymous Invocables.
constexpr _begin_::fn begin
Definition: access.hpp:179
constexpr _end_::fn end
Definition: access.hpp:323

Range concepts below.

◆ rbegin

constexpr _rbegin_::fn ranges::rbegin {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
make_reverse_iterator(r + ranges::size(r)) if r is an array. Otherwise, r.rbegin() if that expression is well-formed and returns an input_or_output_iterator. Otherwise, make_reverse_iterator(ranges::end(r)) if ranges::begin(r) and ranges::end(r) are both well-formed and have the same type that satisfies bidirectional_iterator.

◆ rend

constexpr _rend_::fn ranges::rend {}

#include <range/v3/range/access.hpp>

Parameters
r
Returns
make_reverse_iterator(r) if r is an array. Otherwise, r.rend() if that expression is well-formed and returns a type that satisfies sentinel_for<S, I> where I is the type of ranges::rbegin(r). Otherwise, make_reverse_iterator(ranges::begin(r)) if ranges::begin(r) and ranges::end(r) are both well-formed and have the same type that satisfies bidirectional_iterator.

◆ reservable

template<typename C >
concept ranges::reservable

#include <range/v3/action/concepts.hpp>

Initial value:
=
container<C> && sized_range<C> &&
requires( C & c , C const & cc )
(
c.reserve(ranges::size(c)),
cc.capacity(),
cc.max_size(),
concepts::requires_<same_as<decltype(cc.capacity()),
decltype(ranges::size(c))>>,
concepts::requires_<same_as<decltype(cc.max_size()),
decltype(ranges::size(c))>>
)
requires(sizeof...(Ts) > 0) using lambda
For creating anonymous Invocables.
meta::size_t< L::size()> size
An integral constant wrapper that is the size of the meta::list L.
Definition: meta.hpp:1664

◆ reservable_with_assign

template<typename C , typename I >
concept ranges::reservable_with_assign

#include <range/v3/action/concepts.hpp>

Initial value:
=
reservable<C> && input_iterator<I> &&
requires( C & c , I i )
(
c.assign(i, i)
)
requires(sizeof...(Ts) > 0) using lambda
For creating anonymous Invocables.

◆ semi_container

template<typename T >
concept ranges::semi_container

#include <range/v3/action/concepts.hpp>

Initial value:
=
forward_range<T> && default_constructible<uncvref_t<T>> &&
movable<uncvref_t<T>> &&
!view_<T>

◆ size

constexpr _size_::fn ranges::size {}

#include <range/v3/range/primitives.hpp>

Returns
For a given expression E of type T, ranges::size(E) is equivalent to:
  • +extent_v<T> if T is an array type.
  • Otherwise, +E.size() if it is a valid expression and its type I models integral and disable_sized_range<std::remove_cvref_t<T>> is false.
  • Otherwise, +size(E) if it is a valid expression and its type I models integral with overload resolution performed in a context that includes the declaration:
    template<class T> void size(T&&) = delete;
    and does not include a declaration of ranges::size, and disable_sized_range<std::remove_cvref_t<T>> is false.
  • Otherwise, static_cast<U>(ranges::end(E) - ranges::begin(E)) where U is std::make_unsigned_t<iter_difference_t<iterator_t<T>>> if iter_difference_t<iterator_t<T>> satisfies integral and iter_difference_t<iterator_t<T>> otherwise; except that E is evaluated once, if it is a valid expression and the types I and S of ranges::begin(E) and ranges::end(E) model sized_sentinel_for<S, I> and forward_iterator<I>.
  • Otherwise, ranges::size(E) is ill-formed.

◆ sized_range

template<typename T >
concept ranges::sized_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> &&
!disable_sized_range<uncvref_t<T>> &&
requires( T & t )
(
) &&
ranges::sized_range_ < T >
requires(sizeof...(Ts) > 0) using lambda
For creating anonymous Invocables.
meta::size_t< L::size()> size
An integral constant wrapper that is the size of the meta::list L.
Definition: meta.hpp:1664

◆ view_

template<typename T >
concept ranges::view_

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> &&
semiregular<T> &&
enable_view<T>

View concepts below.

◆ viewable_range

template<typename T >
concept ranges::viewable_range

#include <range/v3/range/concepts.hpp>

Initial value:
=
range<T> &&
(forwarding_range_<T> || view_<detail::decay_t<T>>)