Range-v3
Range algorithms, views, and actions for the Standard Library
ranges::v3::span< T, N > Class Template Reference
+ Inheritance diagram for ranges::v3::span< T, N >:

Public Types

template<typename Rng >
using ConversionConstraint = meta::bool_< SizedRange< Rng >() &&ContiguousRange< Rng >() &&detail::is_more_cv_than< T, concepts::ContiguousRange::datum_t< Rng > >() &&(N==dynamic_extent||range_cardinality< Rng >::value==finite||range_cardinality< Rng >::value==N)>
 
using difference_type = std::ptrdiff_t
 
using element_type = T
 
using index_type = std::ptrdiff_t
 
using iterator = T *
 
using pointer = T *
 
using reference = T &
 
using reverse_iterator = ranges::reverse_iterator< iterator >
 

Public Member Functions

iterator begin () const noexcept
 
constexpr pointer data () const noexcept
 
constexpr bool empty () const noexcept
 
iterator end () const noexcept
 
template<std::ptrdiff_t Count, requires = (N == dynamic_extent || Count <= N)>
constexpr span< T, Count > first () const noexcept
 
constexpr span< T > first (index_type count) const noexcept
 
template<std::ptrdiff_t Count, requires = (N == dynamic_extent || Count <= N)>
constexpr span< T, Count > last () const noexcept
 
constexpr span< T > last (index_type count) const noexcept
 
constexpr index_type length () const noexcept
 
constexpr index_type length_bytes () const noexcept
 
constexpr reference operator() (index_type idx) const noexcept
 
constexpr reference operator[] (index_type idx) const noexcept
 
reverse_iterator rbegin () const noexcept
 
reverse_iterator rend () const noexcept
 
constexpr index_type size () const noexcept
 
constexpr index_type size_bytes () const noexcept
 
constexpr span (std::nullptr_t) noexcept
 
constexpr span (pointer ptr, index_type count) noexcept
 
constexpr span (pointer first, pointer last) noexcept
 
template<typename Int , requires = (SignedIntegral<Int>())>
constexpr span (pointer first, Int count) noexcept
 
template<typename Rng , requires = (ConversionConstraint<Rng>())>
constexpr span (Rng &&rng)
 
template<std::ptrdiff_t Offset, std::ptrdiff_t Count = dynamic_extent, requires = (Count == dynamic_extent || (0 <= Count && (N == dynamic_extent || Offset + Count <= N)))>
constexpr span< T, Count > subspan () const noexcept
 
constexpr span< T > subspan (index_type offset, index_type count=dynamic_extent) const noexcept
 
- Public Member Functions inherited from ranges::v3::view_interface< span< T, N >,(N==dynamic_extent ? finite :static_cast< cardinality >(N))>
range_reference_t< D > back ()
 Access the last element in a range:
 
range_reference_t< D const > back () const
 
constexpr bool empty () const
 
constexpr bool empty () const
 
range_reference_t< D > front ()
 Access the first element in a range:
 
range_reference_t< D const > front () const
 
constexpr operator bool () const
 
 operator Container ()
 Implicit conversion to something that looks like a container.
 
 operator Container () const
 
constexpr bool operator! () const
 
view_interfaceoperator= (view_interface &&)=default
 
view_interfaceoperator= (view_interface const &)=default
 
auto operator[] (range_difference_type_t< D > n) -> decltype(std::declval< D & >().begin()[n])
 Simple indexing:
 
auto operator[] (range_difference_type_t< D > n) const -> decltype(std::declval< D const & >().begin()[n])
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >> offs) &-> decltype(std::declval< Slice >()(std::declval< D & >(), offs.from, offs.to))
 Python-ic slicing:
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >> offs) const &-> decltype(std::declval< Slice >()(std::declval< D const & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >> offs) &&-> decltype(std::declval< Slice >()(std::declval< D >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >, detail::from_end_< range_difference_type_t< D >>> offs) &-> decltype(std::declval< Slice >()(std::declval< D & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >, detail::from_end_< range_difference_type_t< D >>> offs) const &-> decltype(std::declval< Slice >()(std::declval< D const & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >, detail::from_end_< range_difference_type_t< D >>> offs) &&-> decltype(std::declval< Slice >()(std::declval< D >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< detail::from_end_< range_difference_type_t< D >>, detail::from_end_< range_difference_type_t< D >>> offs) &-> decltype(std::declval< Slice >()(std::declval< D & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< detail::from_end_< range_difference_type_t< D >>, detail::from_end_< range_difference_type_t< D >>> offs) const &-> decltype(std::declval< Slice >()(std::declval< D const & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< detail::from_end_< range_difference_type_t< D >>, detail::from_end_< range_difference_type_t< D >>> offs) &&-> decltype(std::declval< Slice >()(std::declval< D >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >, end_fn > offs) &-> decltype(std::declval< Slice >()(std::declval< D & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >, end_fn > offs) const &-> decltype(std::declval< Slice >()(std::declval< D const & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< range_difference_type_t< D >, end_fn > offs) &&-> decltype(std::declval< Slice >()(std::declval< D >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< detail::from_end_< range_difference_type_t< D >>, end_fn > offs) &-> decltype(std::declval< Slice >()(std::declval< D & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< detail::from_end_< range_difference_type_t< D >>, end_fn > offs) const &-> decltype(std::declval< Slice >()(std::declval< D const & >(), offs.from, offs.to))
 
auto operator[] (detail::slice_bounds< detail::from_end_< range_difference_type_t< D >>, end_fn > offs) &&-> decltype(std::declval< Slice >()(std::declval< D >(), offs.from, offs.to))
 
constexpr range_size_type_t< D > size () const
 Access the size of the range, if it can be determined:
 
constexpr range_size_type_t< D > size () const
 
 view_interface (view_interface &&)=default
 
 view_interface (view_interface const &)=default
 

Static Public Attributes

static constexpr index_type extent = N
 

Additional Inherited Members

- Protected Member Functions inherited from ranges::v3::view_interface< span< T, N >,(N==dynamic_extent ? finite :static_cast< cardinality >(N))>
span< T, N > & derived ()
 
span< T, N > const & derived () const