Base Framework
Public Member Functions | Public Attributes | List of all members
Span< TYPE > Class Template Reference

#include <base/mem/Span.h>

Public Member Functions

 Span () noexcept
 
 Span (TYPE *_buffer, MemorySize _size) noexcept
 
 Span (TYPE *_buffer, const TYPE *end) noexcept
 
TYPE * begin () noexcept
 
TYPE * end () noexcept
 
const TYPE * cbegin () const noexcept
 
const TYPE * cend () const noexcept
 
MemorySize getSize () const noexcept
 
TYPE & operator[] (MemorySize index) noexcept
 
const TYPE & operator[] (MemorySize index) const noexcept
 
 operator bool () const noexcept
 

Public Attributes

TYPE * buffer = nullptr
 
MemorySize size = 0
 

Detailed Description

template<class TYPE>
class Span< TYPE >

Sequence of values in memory. The memory is not owned by class. You must ensure that the memory is not released.

Constructor & Destructor Documentation

◆ Span() [1/3]

template<class TYPE >
Span< TYPE >::Span ( )
inlinenoexcept

Initializes empty span.

◆ Span() [2/3]

template<class TYPE >
Span< TYPE >::Span ( TYPE *  _buffer,
MemorySize  _size 
)
inlinenoexcept

Initializes span.

◆ Span() [3/3]

template<class TYPE >
Span< TYPE >::Span ( TYPE *  _buffer,
const TYPE *  end 
)
inlinenoexcept

Initializes span.

Member Function Documentation

◆ begin()

template<class TYPE >
TYPE* Span< TYPE >::begin ( )
inlinenoexcept

Begin iterator.

◆ cbegin()

template<class TYPE >
const TYPE* Span< TYPE >::cbegin ( ) const
inlinenoexcept

Begin iterator.

◆ cend()

template<class TYPE >
const TYPE* Span< TYPE >::cend ( ) const
inlinenoexcept

End iterator.

◆ end()

template<class TYPE >
TYPE* Span< TYPE >::end ( )
inlinenoexcept

End iterator.

◆ getSize()

template<class TYPE >
MemorySize Span< TYPE >::getSize ( ) const
inlinenoexcept

Returns the size.

◆ operator bool()

template<class TYPE >
Span< TYPE >::operator bool ( ) const
inlinenoexcept

Returns true if non-empty.

◆ operator[]() [1/2]

template<class TYPE >
const TYPE& Span< TYPE >::operator[] ( MemorySize  index) const
inlinenoexcept

Returns the item at the given index.

◆ operator[]() [2/2]

template<class TYPE >
TYPE& Span< TYPE >::operator[] ( MemorySize  index)
inlinenoexcept

Returns the item at the given index.