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

Public Types | Public Member Functions | Static Public Attributes | List of all members
ranges::span< T, N > Struct Template Reference
Views
Inheritance diagram for ranges::span< T, N >:

## Public Types
using | difference_type = index_type
using | element_type = T
using | index_type = detail::span_index_t
using | iterator = T *
using | pointer = T *
using | reference = T &
using | reverse_iterator = ranges::reverse_iterator< iterator >
using | value_type = meta::_t< std::remove_cv< T > >

## Public Member Functions
constexpr iterator | begin () const noexcept
constexpr pointer | data () const noexcept
constexpr bool | empty () const noexcept
constexpr iterator | end () const noexcept
template<index_type Count>
constexpr span< T, Count > | first () const noexcept
constexpr span< T > | first (index_type cnt) const noexcept
template<index_type Count>
constexpr span< T, Count > | last () const noexcept
constexpr span< T > | last (index_type cnt) const noexcept
template<typename U , index_type M>
bool | operator!= (span< U, M > const &that) const
template<typename U , index_type M>
bool | operator< (span< U, M > const &that) const
template<typename U , index_type M>
bool | operator<= (span< U, M > const &that) const
template<typename U , index_type M>
bool | operator== (span< U, M > const &that) const
template<typename U , index_type M>
bool | operator> (span< U, M > const &that) const
template<typename U , index_type M>
bool | operator>= (span< U, M > const &that) const
constexpr reference | operator[] (index_type idx) const noexcept
constexpr reverse_iterator | rbegin () const noexcept
constexpr reverse_iterator | rend () const noexcept
constexpr index_type | size_bytes () const noexcept
template<typename = void>
constexpr | span (pointer first, pointer last) noexcept
constexpr | span (pointer ptr, index_type cnt) noexcept
template<typename Rng >
constexpr | span (Rng &&rng) noexcept(noexcept(ranges::data(rng)))
template<typename Rng >
constexpr | span (Rng &&rng) noexcept(noexcept(ranges::data(rng), ranges::size(rng)))
template<index_type Offset, index_type Count>
constexpr span< T, detail::subspan_extent(N, Offset, Count)> | subspan () const noexcept
template<index_type Offset>
constexpr span< T,(N >=Offset ? N - Offset :dynamic_extent)> | subspan () const noexcept
constexpr span< T, dynamic_extent > | subspan (index_type offset) const noexcept
constexpr span< T, dynamic_extent > | subspan (index_type offset, index_type cnt) const noexcept
Public Member Functions inherited from ranges::view_interface< span< T, dynamic_extent >,(dynamic_extent==dynamic_extent ? finite :static_cast< cardinality >(dynamic_extent))>
constexpr range_reference_t< D< True > > | at (range_difference_t< D< True >> n)
| Returns a reference to the element at specified location pos, with bounds checking. More...
constexpr range_reference_t< D< True > const > | at (range_difference_t< D< True >> n) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr range_reference_t< D< True > > | back ()
| Access the last element in a range: More...
constexpr range_reference_t< D< True > const > | back () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr std::add_pointer_t< range_reference_t< D< True > > > | data ()
| Returns a pointer to the block of memory containing the elements of a contiguous range: More...
constexpr std::add_pointer_t< range_reference_t< D< True > const > > | data () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | empty () const noexcept -> bool
| Test whether a range can be empty:
constexpr bool | empty () const noexcept(noexcept(bool(ranges::begin(std::declval< D< True > const & >())==ranges::end(std::declval< D< True > const & >()))))
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr bool | empty () const noexcept(noexcept(bool(ranges::size(std::declval< D< True > const & >())==0)))
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr bool | empty () noexcept(noexcept(bool(ranges::begin(std::declval< D< True > & >())==ranges::end(std::declval< D< True > & >()))))
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr bool | empty () noexcept(noexcept(bool(ranges::size(std::declval< D< True > & >())==0)))
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr range_reference_t< D< True > > | front ()
| Access the first element in a range: More...
constexpr range_reference_t< D< True > const > | front () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr | operator bool () const noexcept(noexcept(ranges::empty(std::declval< D< True > const & >())))
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr | operator bool () noexcept(noexcept(ranges::empty(std::declval< D< True > & >())))
view_interface & | operator= (view_interface &&)=default
view_interface & | operator= (view_interface const &)=default
constexpr auto | operator[] (detail::slice_bounds< detail::from_end_of_t< D< True >>, detail::from_end_of_t< D< True >>> offs) &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< detail::from_end_of_t< D< True >>, detail::from_end_of_t< D< True >>> offs) &&
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< detail::from_end_of_t< D< True >>, detail::from_end_of_t< D< True >>> offs) const &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< detail::from_end_of_t< D< True >>, end_fn > offs) &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< detail::from_end_of_t< D< True >>, end_fn > offs) &&
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< detail::from_end_of_t< D< True >>, end_fn > offs) const &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>, detail::from_end_of_t< D< True >>> offs) &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>, detail::from_end_of_t< D< True >>> offs) &&
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>, detail::from_end_of_t< D< True >>> offs) const &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>, end_fn > offs) &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>, end_fn > offs) &&
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>, end_fn > offs) const &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>> offs) &
| Python-ic slicing: More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>> offs) &&
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr auto | operator[] (detail::slice_bounds< range_difference_t< D< True >>> offs) const &
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr range_reference_t< D< True > > | operator[] (range_difference_t< D< True >> n)
| Simple indexing: More...
constexpr range_reference_t< D< True > const > | operator[] (range_difference_t< D< True >> n) const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
constexpr detail::iter_size_t< iterator_t< D< True > > > | size ()
| If `sized_sentinel_for<sentinel_t<Derived>, iterator_t<Derived>>` is satisfied, and if `Derived` is a `forward_range`, then return `end - begin` cast to an unsigned integer. More...
constexpr detail::iter_size_t< iterator_t< D< True > > > | size () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
| view_interface (view_interface &&)=default
| view_interface (view_interface const &)=default

## Static Public Attributes
static constexpr index_type | extent = N

## Additional Inherited Members
Static Public Member Functions inherited from ranges::view_interface< span< T, dynamic_extent >,(dynamic_extent==dynamic_extent ? finite :static_cast< cardinality >(dynamic_extent))>
static constexpr std::size_t | size () noexcept
| If the size of the range is known at compile-time and finite, return it. More...
Protected Types inherited from ranges::view_interface< span< T, dynamic_extent >,(dynamic_extent==dynamic_extent ? finite :static_cast< cardinality >(dynamic_extent))>
using | D = meta::invoke< detail::dependent_< B >, span< T, dynamic_extent > >
Protected Member Functions inherited from ranges::view_interface< span< T, dynamic_extent >,(dynamic_extent==dynamic_extent ? finite :static_cast< cardinality >(dynamic_extent))>
constexpr span< T, dynamic_extent > const & | derived () const noexcept
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
constexpr span< T, dynamic_extent > & | derived () noexcept

## Member Function Documentation

## ◆ operator!=()

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename U , index_type M>

bool ranges::span< T, N >::operator!= | ( | span< U, M > const & | that | ) | const

Precondition
  requires `equality_comparable_with<T, U>`

## ◆ operator<()

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename U , index_type M>

bool ranges::span< T, N >::operator< | ( | span< U, M > const & | that | ) | const

Precondition
  requires `totally_ordered_with<T, U>`

## ◆ operator<=()

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename U , index_type M>

bool ranges::span< T, N >::operator<= | ( | span< U, M > const & | that | ) | const

Precondition
  requires `totally_ordered_with<T, U>`

## ◆ operator==()

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename U , index_type M>

bool ranges::span< T, N >::operator== | ( | span< U, M > const & | that | ) | const

Precondition
  requires `equality_comparable_with<T, U>`

References ranges::begin.

## ◆ operator>()

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename U , index_type M>

bool ranges::span< T, N >::operator> | ( | span< U, M > const & | that | ) | const

Precondition
  requires `totally_ordered_with<T, U>`

## ◆ operator>=()

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename U , index_type M>

bool ranges::span< T, N >::operator>= | ( | span< U, M > const & | that | ) | const

Precondition
  requires `totally_ordered_with<T, U>`

## Constructor & Destructor Documentation

## ◆ span() [1/2]

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename Rng >

constexpr ranges::span< T, N >::span | ( | Rng && | rng | ) |
| constexpr noexcept

Precondition
  requires `(!same_as<span, uncvref_t<Rng>>) && span_compatible_range<Rng, T> && span_dynamic_conversion<Rng, N>`

## ◆ span() [2/2]

template<typename T , detail::span_index_t N = dynamic_extent>
template<typename Rng >

constexpr ranges::span< T, N >::span | ( | Rng && | rng | ) |
| constexpr noexcept

Precondition
  requires `(!same_as<span, uncvref_t<Rng>>) && span_compatible_range<Rng, T> && span_static_conversion<Rng, N>`