SpECTRE  v2024.04.12
gsl::span< ElementType, Extent > Class Template Reference

Create a span/view on a range, which is cheap to copy (one pointer). More...

#include <Gsl.hpp>

Public Types

using element_type = ElementType
 
using value_type = std::remove_cv_t< ElementType >
 
using index_type = size_t
 
using pointer = element_type *
 
using reference = element_type &
 
using iterator = detail::span_iterator< span< ElementType, Extent >, false >
 
using const_iterator = detail::span_iterator< span< ElementType, Extent >, true >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using size_type = index_type
 

Public Member Functions

constexpr span (pointer ptr, index_type count)
 
constexpr span (pointer firstElem, pointer lastElem)
 
template<std::size_t N>
constexpr span (element_type(&arr)[N])
 
template<std::size_t N, Requires<(N > 0)> = nullptr>
constexpr span (std::array< std::remove_const_t< element_type >, N > &arr)
 
constexpr span (std::array< std::remove_const_t< element_type >, 0 > &)
 
template<std::size_t N, Requires<(N > 0)> = nullptr>
constexpr span (const std::array< std::remove_const_t< element_type >, N > &arr)
 
constexpr span (const std::array< std::remove_const_t< element_type >, 0 > &)
 
template<class Container , Requires< !detail::is_span< Container >::value &&!detail::is_std_array< Container >::value &&std::is_convertible< typename Container::pointer, pointer >::value &&std::is_convertible< typename Container::pointer, decltype(std::declval< Container >().data())>::value >
constexpr span (Container &cont)
 
template<class Container , Requires< std::is_const< element_type >::value &&!detail::is_span< Container >::value &&std::is_convertible< typename Container::pointer, pointer >::value &&std::is_convertible< typename Container::pointer, decltype(std::declval< Container >().data())>::value >
constexpr span (const Container &cont)
 
constexpr span (const span &other)=default
 
template<class OtherElementType , std::ptrdiff_t OtherExtent, Requires< detail::is_allowed_extent_conversion< OtherExtent, Extent >::value &&detail::is_allowed_element_type_conversion< OtherElementType, element_type >::value > = nullptr>
constexpr span (const span< OtherElementType, OtherExtent > &other)
 
constexpr spanoperator= (const span &other)=default
 
template<std::ptrdiff_t Count>
constexpr span< element_type, Count > first () const
 
template<std::ptrdiff_t Count>
constexpr span< element_type, Count > last () const
 
template<std::ptrdiff_t Offset, std::ptrdiff_t Count = dynamic_extent>
constexpr auto subspan () const -> typename detail::calculate_subspan_type< ElementType, Extent, Offset, Count >::type
 
constexpr span< element_type, dynamic_extent > first (index_type count) const
 
constexpr span< element_type, dynamic_extent > last (index_type count) const
 
constexpr span< element_type, dynamic_extent > subspan (index_type offset, index_type count=dynamic_extent) const
 
constexpr index_type size () const
 
constexpr index_type size_bytes () const
 
constexpr bool empty () const
 
constexpr reference operator[] (index_type idx) const
 
constexpr reference at (index_type idx) const
 
constexpr reference operator() (index_type idx) const
 
constexpr pointer data () const
 
constexpr iterator begin () const
 
constexpr iterator end () const
 
constexpr const_iterator cbegin () const
 
constexpr const_iterator cend () const
 
constexpr reverse_iterator rbegin () const
 
constexpr reverse_iterator rend () const
 
constexpr const_reverse_iterator crbegin () const
 
constexpr const_reverse_iterator crend () const
 

Static Public Attributes

static constexpr index_type extent {Extent}
 

Detailed Description

template<class ElementType, std::ptrdiff_t Extent>
class gsl::span< ElementType, Extent >

Create a span/view on a range, which is cheap to copy (one pointer).


The documentation for this class was generated from the following file: