openMSX
Public Types | Public Member Functions | Static Public Attributes | List of all members
span< ElementType, Extent > Class Template Reference

#include <span.hh>

Inheritance diagram for span< ElementType, Extent >:
Inheritance graph
[legend]

Public Types

using element_type = ElementType
 
using value_type = std::remove_cv_t< ElementType >
 
using index_type = size_t
 
using difference_type = ptrdiff_t
 
using pointer = ElementType *
 
using reference = ElementType &
 
using iterator = pointer
 
using const_iterator = const ElementType *
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
template<ptrdiff_t Offset, size_t Count = dynamic_extent>
using subspan_return_t = span< ElementType, Count !=dynamic_extent ? Count :(Extent !=dynamic_extent ? Extent - Offset :dynamic_extent)>
 

Public Member Functions

template<size_t E = Extent, std::enable_if_t<(E==0)||(E==dynamic_extent), int > = 0>
constexpr span () noexcept
 
constexpr span (pointer ptr, index_type count)
 
constexpr span (pointer first_elem, pointer last_elem)
 
template<size_t N, size_t E = Extent, std::enable_if_t<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< element_type(&)[N], ElementType >::value, int > = 0>
constexpr span (element_type(&arr)[N]) noexcept
 
template<size_t N, size_t E = Extent, std::enable_if_t<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< std::array< value_type, N > &, ElementType >::value, int > = 0>
constexpr span (std::array< value_type, N > &arr) noexcept
 
template<size_t N, size_t E = Extent, std::enable_if_t<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< const std::array< value_type, N > &, ElementType >::value, int > = 0>
constexpr span (const std::array< value_type, N > &arr) noexcept
 
template<typename Container , std::enable_if_t< detail::is_container< Container >::value &&detail::is_container_element_type_compatible< Container &, ElementType >::value, int > = 0>
constexpr span (Container &cont)
 
template<typename Container , std::enable_if_t< detail::is_container< Container >::value &&detail::is_container_element_type_compatible< const Container &, ElementType >::value, int > = 0>
constexpr span (const Container &cont)
 
constexpr span (const span &other) noexcept=default
 
template<typename OtherElementType , size_t OtherExtent, std::enable_if_t<(Extent==OtherExtent||Extent==dynamic_extent) &&std::is_convertible_v< OtherElementType(*)[], ElementType(*)[]>, int > = 0>
constexpr span (const span< OtherElementType, OtherExtent > &other) noexcept
 
 ~span () noexcept=default
 
constexpr spanoperator= (const span &other) noexcept=default
 
template<size_t Count>
constexpr span< element_type, Count > first () const
 
template<size_t Count>
constexpr span< element_type, Count > last () const
 
template<ptrdiff_t Offset, size_t Count = dynamic_extent>
constexpr subspan_return_t< Offset, Count > subspan () const
 
constexpr span< element_type, dynamic_extentfirst (index_type count) const
 
constexpr span< element_type, dynamic_extentlast (index_type count) const
 
constexpr span< element_type, dynamic_extentsubspan (index_type offset, index_type count=dynamic_extent) const
 
constexpr index_type size () const noexcept
 
constexpr index_type size_bytes () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr reference operator[] (index_type idx) const
 
constexpr reference front () const
 
constexpr reference back () const
 
constexpr pointer data () const noexcept
 
constexpr iterator begin () const noexcept
 
constexpr iterator end () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr auto rbegin () const noexcept
 
constexpr auto rend () const noexcept
 
constexpr auto crbegin () const noexcept
 
constexpr auto crend () const noexcept
 

Static Public Attributes

static constexpr index_type extent = Extent
 

Detailed Description

template<typename ElementType, size_t Extent>
class span< ElementType, Extent >

Definition at line 125 of file span.hh.

Member Typedef Documentation

◆ const_iterator

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::const_iterator = const ElementType*

Definition at line 150 of file span.hh.

◆ const_reverse_iterator

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 152 of file span.hh.

◆ difference_type

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::difference_type = ptrdiff_t

Definition at line 146 of file span.hh.

◆ element_type

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::element_type = ElementType

Definition at line 143 of file span.hh.

◆ index_type

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::index_type = size_t

Definition at line 145 of file span.hh.

◆ iterator

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::iterator = pointer

Definition at line 149 of file span.hh.

◆ pointer

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::pointer = ElementType*

Definition at line 147 of file span.hh.

◆ reference

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::reference = ElementType&

Definition at line 148 of file span.hh.

◆ reverse_iterator

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 151 of file span.hh.

◆ subspan_return_t

template<typename ElementType , size_t Extent>
template<ptrdiff_t Offset, size_t Count = dynamic_extent>
using span< ElementType, Extent >::subspan_return_t = span<ElementType, Count != dynamic_extent ? Count : (Extent != dynamic_extent ? Extent - Offset : dynamic_extent)>

Definition at line 260 of file span.hh.

◆ value_type

template<typename ElementType , size_t Extent>
using span< ElementType, Extent >::value_type = std::remove_cv_t<ElementType>

Definition at line 144 of file span.hh.

Constructor & Destructor Documentation

◆ span() [1/10]

template<typename ElementType , size_t Extent>
template<size_t E = Extent, std::enable_if_t<(E==0)||(E==dynamic_extent), int > = 0>
constexpr span< ElementType, Extent >::span ( )
inlineconstexprnoexcept

Definition at line 158 of file span.hh.

◆ span() [2/10]

template<typename ElementType , size_t Extent>
constexpr span< ElementType, Extent >::span ( pointer  ptr,
index_type  count 
)
inlineconstexpr

Definition at line 162 of file span.hh.

◆ span() [3/10]

template<typename ElementType , size_t Extent>
constexpr span< ElementType, Extent >::span ( pointer  first_elem,
pointer  last_elem 
)
inlineconstexpr

Definition at line 168 of file span.hh.

◆ span() [4/10]

template<typename ElementType , size_t Extent>
template<size_t N, size_t E = Extent, std::enable_if_t<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< element_type(&)[N], ElementType >::value, int > = 0>
constexpr span< ElementType, Extent >::span ( element_type(&)  arr[N])
inlineconstexprnoexcept

Definition at line 181 of file span.hh.

◆ span() [5/10]

template<typename ElementType , size_t Extent>
template<size_t N, size_t E = Extent, std::enable_if_t<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< std::array< value_type, N > &, ElementType >::value, int > = 0>
constexpr span< ElementType, Extent >::span ( std::array< value_type, N > &  arr)
inlineconstexprnoexcept

Definition at line 192 of file span.hh.

◆ span() [6/10]

template<typename ElementType , size_t Extent>
template<size_t N, size_t E = Extent, std::enable_if_t<(E==dynamic_extent||N==E) &&detail::is_container_element_type_compatible< const std::array< value_type, N > &, ElementType >::value, int > = 0>
constexpr span< ElementType, Extent >::span ( const std::array< value_type, N > &  arr)
inlineconstexprnoexcept

Definition at line 203 of file span.hh.

◆ span() [7/10]

template<typename ElementType , size_t Extent>
template<typename Container , std::enable_if_t< detail::is_container< Container >::value &&detail::is_container_element_type_compatible< Container &, ElementType >::value, int > = 0>
constexpr span< ElementType, Extent >::span ( Container &  cont)
inlineconstexpr

Definition at line 212 of file span.hh.

◆ span() [8/10]

template<typename ElementType , size_t Extent>
template<typename Container , std::enable_if_t< detail::is_container< Container >::value &&detail::is_container_element_type_compatible< const Container &, ElementType >::value, int > = 0>
constexpr span< ElementType, Extent >::span ( const Container &  cont)
inlineconstexpr

Definition at line 222 of file span.hh.

◆ span() [9/10]

template<typename ElementType , size_t Extent>
constexpr span< ElementType, Extent >::span ( const span< ElementType, Extent > &  other)
constexprdefaultnoexcept

◆ span() [10/10]

template<typename ElementType , size_t Extent>
template<typename OtherElementType , size_t OtherExtent, std::enable_if_t<(Extent==OtherExtent||Extent==dynamic_extent) &&std::is_convertible_v< OtherElementType(*)[], ElementType(*)[]>, int > = 0>
constexpr span< ElementType, Extent >::span ( const span< OtherElementType, OtherExtent > &  other)
inlineconstexprnoexcept

Definition at line 235 of file span.hh.

◆ ~span()

template<typename ElementType , size_t Extent>
span< ElementType, Extent >::~span ( )
defaultnoexcept

Member Function Documentation

◆ back()

template<typename ElementType , size_t Extent>
constexpr reference span< ElementType, Extent >::back ( ) const
inlineconstexpr

Definition at line 317 of file span.hh.

◆ begin()

template<typename ElementType , size_t Extent>
constexpr iterator span< ElementType, Extent >::begin ( ) const
inlineconstexprnoexcept

Definition at line 326 of file span.hh.

Referenced by span< const uint8_t >::cbegin(), and span< const uint8_t >::rend().

◆ cbegin()

template<typename ElementType , size_t Extent>
constexpr const_iterator span< ElementType, Extent >::cbegin ( ) const
inlineconstexprnoexcept

Definition at line 328 of file span.hh.

Referenced by span< const uint8_t >::crend().

◆ cend()

template<typename ElementType , size_t Extent>
constexpr const_iterator span< ElementType, Extent >::cend ( ) const
inlineconstexprnoexcept

Definition at line 329 of file span.hh.

Referenced by span< const uint8_t >::crbegin().

◆ crbegin()

template<typename ElementType , size_t Extent>
constexpr auto span< ElementType, Extent >::crbegin ( ) const
inlineconstexprnoexcept

Definition at line 333 of file span.hh.

◆ crend()

template<typename ElementType , size_t Extent>
constexpr auto span< ElementType, Extent >::crend ( ) const
inlineconstexprnoexcept

Definition at line 334 of file span.hh.

◆ data()

template<typename ElementType , size_t Extent>
constexpr pointer span< ElementType, Extent >::data ( ) const
inlineconstexprnoexcept

◆ empty()

template<typename ElementType , size_t Extent>
constexpr bool span< ElementType, Extent >::empty ( ) const
inlineconstexprnoexcept

◆ end()

template<typename ElementType , size_t Extent>
constexpr iterator span< ElementType, Extent >::end ( ) const
inlineconstexprnoexcept

Definition at line 327 of file span.hh.

Referenced by span< const uint8_t >::cend(), and span< const uint8_t >::rbegin().

◆ first() [1/2]

template<typename ElementType , size_t Extent>
template<size_t Count>
constexpr span<element_type, Count> span< ElementType, Extent >::first ( ) const
inlineconstexpr

Definition at line 246 of file span.hh.

◆ first() [2/2]

template<typename ElementType , size_t Extent>
constexpr span<element_type, dynamic_extent> span< ElementType, Extent >::first ( index_type  count) const
inlineconstexpr

Definition at line 275 of file span.hh.

◆ front()

template<typename ElementType , size_t Extent>
constexpr reference span< ElementType, Extent >::front ( ) const
inlineconstexpr

◆ last() [1/2]

template<typename ElementType , size_t Extent>
template<size_t Count>
constexpr span<element_type, Count> span< ElementType, Extent >::last ( ) const
inlineconstexpr

Definition at line 253 of file span.hh.

◆ last() [2/2]

template<typename ElementType , size_t Extent>
constexpr span<element_type, dynamic_extent> span< ElementType, Extent >::last ( index_type  count) const
inlineconstexpr

Definition at line 281 of file span.hh.

◆ operator=()

template<typename ElementType , size_t Extent>
constexpr span& span< ElementType, Extent >::operator= ( const span< ElementType, Extent > &  other)
constexprdefaultnoexcept

◆ operator[]()

template<typename ElementType , size_t Extent>
constexpr reference span< ElementType, Extent >::operator[] ( index_type  idx) const
inlineconstexpr

Definition at line 303 of file span.hh.

◆ rbegin()

template<typename ElementType , size_t Extent>
constexpr auto span< ElementType, Extent >::rbegin ( ) const
inlineconstexprnoexcept

Definition at line 331 of file span.hh.

◆ rend()

template<typename ElementType , size_t Extent>
constexpr auto span< ElementType, Extent >::rend ( ) const
inlineconstexprnoexcept

Definition at line 332 of file span.hh.

◆ size()

template<typename ElementType , size_t Extent>
constexpr index_type span< ElementType, Extent >::size ( ) const
inlineconstexprnoexcept

◆ size_bytes()

template<typename ElementType , size_t Extent>
constexpr index_type span< ElementType, Extent >::size_bytes ( ) const
inlineconstexprnoexcept

Definition at line 298 of file span.hh.

◆ subspan() [1/2]

template<typename ElementType , size_t Extent>
template<ptrdiff_t Offset, size_t Count = dynamic_extent>
constexpr subspan_return_t<Offset, Count> span< ElementType, Extent >::subspan ( ) const
inlineconstexpr

◆ subspan() [2/2]

template<typename ElementType , size_t Extent>
constexpr span<element_type, dynamic_extent> span< ElementType, Extent >::subspan ( index_type  offset,
index_type  count = dynamic_extent 
) const
inlineconstexpr

Definition at line 287 of file span.hh.

Member Data Documentation

◆ extent

template<typename ElementType , size_t Extent>
constexpr index_type span< ElementType, Extent >::extent = Extent
staticconstexpr

Definition at line 154 of file span.hh.

Referenced by span< const uint8_t >::span().


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