Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
PS::span< T > Class Template Reference

Simplifed version of std::span (C++20) as we don't support the original one yet. More...

#include <Span.h>

Public Types

using element_type = T
 
using value_type = std::remove_cv_t< T >
 
using size_type = size_t
 
using pointer = T *
 
using reference = T &
 
using iterator = pointer
 

Public Member Functions

constexpr span ()
 
constexpr span (iterator first, size_type extent)
 
constexpr span (iterator first, iterator last)
 
template<typename OtherT , size_t N>
constexpr span (const std::array< OtherT, N > &arr)
 
template<typename ContinuousRange >
constexpr span (ContinuousRange &range)
 
constexpr span (const span &other)=default
 
constexpr spanoperator= (const span &other)=default
 
 ~span ()=default
 
constexpr size_type size () const
 
constexpr bool empty () const
 
constexpr reference operator[] (size_type index) const
 
constexpr pointer data () const
 
constexpr iterator begin () const
 
constexpr iterator end () const
 
constexpr span subspan (size_type offset) const
 

Private Attributes

pointer m_Pointer
 
size_type m_Extent
 

Detailed Description

template<typename T>
class PS::span< T >

Simplifed version of std::span (C++20) as we don't support the original one yet.

The naming intentionally follows the STL version to make the future replacement easier with less blame changing. It supports only very basic subset of std::span functionality. TODO: remove as soon as std::span become available.

Member Typedef Documentation

◆ element_type

template<typename T >
using PS::span< T >::element_type = T

◆ iterator

template<typename T >
using PS::span< T >::iterator = pointer

◆ pointer

template<typename T >
using PS::span< T >::pointer = T*

◆ reference

template<typename T >
using PS::span< T >::reference = T&

◆ size_type

template<typename T >
using PS::span< T >::size_type = size_t

◆ value_type

template<typename T >
using PS::span< T >::value_type = std::remove_cv_t<T>

Constructor & Destructor Documentation

◆ span() [1/6]

template<typename T >
constexpr PS::span< T >::span ( )
inlineconstexpr

◆ span() [2/6]

template<typename T >
constexpr PS::span< T >::span ( iterator  first,
size_type  extent 
)
inlineconstexpr

◆ span() [3/6]

template<typename T >
constexpr PS::span< T >::span ( iterator  first,
iterator  last 
)
inlineconstexpr

◆ span() [4/6]

template<typename T >
template<typename OtherT , size_t N>
constexpr PS::span< T >::span ( const std::array< OtherT, N > &  arr)
inlineconstexpr

◆ span() [5/6]

template<typename T >
template<typename ContinuousRange >
constexpr PS::span< T >::span ( ContinuousRange &  range)
inlineconstexpr

◆ span() [6/6]

template<typename T >
constexpr PS::span< T >::span ( const span< T > &  other)
constexprdefault

◆ ~span()

template<typename T >
PS::span< T >::~span ( )
default

Member Function Documentation

◆ begin()

template<typename T >
constexpr iterator PS::span< T >::begin ( ) const
inlineconstexpr

◆ data()

template<typename T >
constexpr pointer PS::span< T >::data ( ) const
inlineconstexpr

◆ empty()

template<typename T >
constexpr bool PS::span< T >::empty ( ) const
inlineconstexpr

◆ end()

template<typename T >
constexpr iterator PS::span< T >::end ( ) const
inlineconstexpr

◆ operator=()

template<typename T >
constexpr span & PS::span< T >::operator= ( const span< T > &  other)
constexprdefault

◆ operator[]()

template<typename T >
constexpr reference PS::span< T >::operator[] ( size_type  index) const
inlineconstexpr

◆ size()

template<typename T >
constexpr size_type PS::span< T >::size ( ) const
inlineconstexpr

◆ subspan()

template<typename T >
constexpr span PS::span< T >::subspan ( size_type  offset) const
inlineconstexpr

Member Data Documentation

◆ m_Extent

template<typename T >
size_type PS::span< T >::m_Extent
private

◆ m_Pointer

template<typename T >
pointer PS::span< T >::m_Pointer
private

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