libcopp  2.2.0
Public Types | Public Member Functions | Static Public Attributes | Private Attributes
gsl::span< T, EXTENT > Class Template Reference

#include <span.h>

Collaboration diagram for gsl::span< T, EXTENT >:
Collaboration graph

Public Types

using element_type = T
 
using value_type = typename std::remove_cv< T >::type
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using pointer = T *
 
using const_pointer = const T *
 
using reference = T &
 
using const_reference = const T &
 
using iterator = T *
 
using reverse_iterator = std::reverse_iterator< iterator >
 

Public Member Functions

template<bool B = EXTENT == 0, typename std::enable_if< B >::type * = nullptr>
 span () noexcept
 
 span (T *input_data, size_t count) noexcept
 
 span (T *first, T *last) noexcept
 
template<size_t N, typename std::enable_if< EXTENT==N >::type * = nullptr>
 span (T(&array)[N]) noexcept
 
template<size_t N, typename std::enable_if< EXTENT==N >::type * = nullptr>
 span (std::array< T, N > &array) noexcept
 
template<size_t N, typename std::enable_if< EXTENT==N >::type * = nullptr>
 span (const std::array< T, N > &array) noexcept
 
template<class C , typename std::enable_if< !detail::is_specialized_span_convertible< typename std::decay< C >::type >::value &&std::is_convertible< typename std::remove_pointer< decltype(std::declval< C >().size())>::type(*)[], T(*)[]>::value &&std::is_convertible< decltype(std::declval< C >().size()), size_t >::value , ::type * = nullptr>
 span (C &&c) noexcept(noexcept(c.data(), c.size()))
 
template<class U , size_t N, typename std::enable_if< N==EXTENT &&std::is_convertible< U(*)[], T(*)[]>::value >::type * = nullptr>
 span (const span< U, N > &other) noexcept
 
 span (const span &) noexcept=default
 
bool empty () const noexcept
 
T * data () const noexcept
 
size_t size () const noexcept
 
T & operator[] (size_t index) const noexcept
 
T * begin () const noexcept
 
T * end () const noexcept
 

Static Public Attributes

static constexpr size_t extent = EXTENT
 

Private Attributes

T * data_
 

Detailed Description

template<class T, size_t EXTENT>
class gsl::span< T, EXTENT >

Back port of std::span.

See https://en.cppreference.com/w/cpp/container/span for interface documentation.

Note: This provides a subset of the methods available on std::span.

Note: The std::span API specifies error cases to have undefined behavior, so this implementation chooses to terminate or assert rather than throw exceptions.

Definition at line 99 of file span.h.

Member Typedef Documentation

◆ const_pointer

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::const_pointer = const T *

Definition at line 107 of file span.h.

◆ const_reference

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::const_reference = const T &

Definition at line 109 of file span.h.

◆ difference_type

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::difference_type = std::ptrdiff_t

Definition at line 105 of file span.h.

◆ element_type

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::element_type = T

Definition at line 102 of file span.h.

◆ iterator

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::iterator = T *

Definition at line 110 of file span.h.

◆ pointer

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::pointer = T *

Definition at line 106 of file span.h.

◆ reference

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::reference = T &

Definition at line 108 of file span.h.

◆ reverse_iterator

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 111 of file span.h.

◆ size_type

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::size_type = std::size_t

Definition at line 104 of file span.h.

◆ value_type

template<class T , size_t EXTENT>
using gsl::span< T, EXTENT >::value_type = typename std::remove_cv<T>::type

Definition at line 103 of file span.h.

Constructor & Destructor Documentation

◆ span() [1/9]

template<class T , size_t EXTENT>
template<bool B = EXTENT == 0, typename std::enable_if< B >::type * = nullptr>
gsl::span< T, EXTENT >::span ( )
inlinenoexcept

Definition at line 118 of file span.h.

◆ span() [2/9]

template<class T , size_t EXTENT>
gsl::span< T, EXTENT >::span ( T *  input_data,
size_t  count 
)
inlinenoexcept

Definition at line 120 of file span.h.

◆ span() [3/9]

template<class T , size_t EXTENT>
gsl::span< T, EXTENT >::span ( T *  first,
T *  last 
)
inlinenoexcept

Definition at line 126 of file span.h.

◆ span() [4/9]

template<class T , size_t EXTENT>
template<size_t N, typename std::enable_if< EXTENT==N >::type * = nullptr>
gsl::span< T, EXTENT >::span ( T(&)  array[N])
inlinenoexcept

Definition at line 133 of file span.h.

◆ span() [5/9]

template<class T , size_t EXTENT>
template<size_t N, typename std::enable_if< EXTENT==N >::type * = nullptr>
gsl::span< T, EXTENT >::span ( std::array< T, N > &  array)
inlinenoexcept

Definition at line 136 of file span.h.

◆ span() [6/9]

template<class T , size_t EXTENT>
template<size_t N, typename std::enable_if< EXTENT==N >::type * = nullptr>
gsl::span< T, EXTENT >::span ( const std::array< T, N > &  array)
inlinenoexcept

Definition at line 139 of file span.h.

◆ span() [7/9]

template<class T , size_t EXTENT>
template<class C , typename std::enable_if< !detail::is_specialized_span_convertible< typename std::decay< C >::type >::value &&std::is_convertible< typename std::remove_pointer< decltype(std::declval< C >().size())>::type(*)[], T(*)[]>::value &&std::is_convertible< decltype(std::declval< C >().size()), size_t >::value , ::type * = nullptr>
gsl::span< T, EXTENT >::span ( C &&  c)
inlinenoexcept

Definition at line 147 of file span.h.

◆ span() [8/9]

template<class T , size_t EXTENT>
template<class U , size_t N, typename std::enable_if< N==EXTENT &&std::is_convertible< U(*)[], T(*)[]>::value >::type * = nullptr>
gsl::span< T, EXTENT >::span ( const span< U, N > &  other)
inlinenoexcept

Definition at line 155 of file span.h.

◆ span() [9/9]

template<class T , size_t EXTENT>
gsl::span< T, EXTENT >::span ( const span< T, EXTENT > &  )
defaultnoexcept

Member Function Documentation

◆ begin()

template<class T , size_t EXTENT>
T* gsl::span< T, EXTENT >::begin ( ) const
inlinenoexcept

Definition at line 170 of file span.h.

References gsl::span< T, EXTENT >::data_.

◆ data()

template<class T , size_t EXTENT>
T* gsl::span< T, EXTENT >::data ( ) const
inlinenoexcept

Definition at line 161 of file span.h.

References gsl::span< T, EXTENT >::data_.

◆ empty()

template<class T , size_t EXTENT>
bool gsl::span< T, EXTENT >::empty ( ) const
inlinenoexcept

Definition at line 159 of file span.h.

◆ end()

template<class T , size_t EXTENT>
T* gsl::span< T, EXTENT >::end ( ) const
inlinenoexcept

Definition at line 172 of file span.h.

References gsl::span< T, EXTENT >::data_.

◆ operator[]()

template<class T , size_t EXTENT>
T& gsl::span< T, EXTENT >::operator[] ( size_t  index) const
inlinenoexcept

Definition at line 165 of file span.h.

References gsl::span< T, EXTENT >::data_.

◆ size()

template<class T , size_t EXTENT>
size_t gsl::span< T, EXTENT >::size ( ) const
inlinenoexcept

Definition at line 163 of file span.h.

Field Documentation

◆ data_

template<class T , size_t EXTENT>
T* gsl::span< T, EXTENT >::data_
private

◆ extent

template<class T , size_t EXTENT>
constexpr size_t gsl::span< T, EXTENT >::extent = EXTENT
staticconstexpr

Definition at line 101 of file span.h.


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