A C++ encapsulation of an array and its size. More...
#include <Span.hpp>
Public Types | |
using | data_type = T |
Data type. | |
using | pointer = data_type * |
Pointer type. | |
using | const_pointer = const data_type * |
Constant pointer type. | |
using | size_type = std::size_t |
Size type. | |
Public Member Functions | |
Span (const Span ©)=default | |
Copy constructor. | |
constexpr | Span (pointer array, size_type size) noexcept |
Initializing constructor. | |
template<std::size_t SIZE> | |
constexpr | Span (data_type(&array)[SIZE]) noexcept |
Initializing constructor. | |
template<typename U , typename = std::enable_if_t< !std::is_array<U>::value >> | |
constexpr | Span (U &value) noexcept |
Initializing constructor. | |
constexpr | Span (std::initializer_list< T > list) noexcept |
Initializing constructor. | |
pointer | begin () const noexcept |
Gets the "begin" iterator value. | |
const_pointer | cbegin () const noexcept |
Gets the "begin" iterator value. | |
pointer | end () const noexcept |
Gets the "end" iterator value. | |
const_pointer | cend () const noexcept |
Gets the "end" iterator value. | |
data_type & | operator[] (size_type index) noexcept |
Accesses the indexed element. | |
const data_type & | operator[] (size_type index) const noexcept |
Accesses the indexed element. | |
constexpr size_type | size () const noexcept |
Gets the size of this span. | |
pointer | data () const noexcept |
Direct access to data. | |
constexpr bool | empty () const noexcept |
Checks whether this span is empty. | |
Private Attributes | |
pointer | m_array = nullptr |
Pointer to array of data. | |
size_type | m_size = 0 |
Size of array of data. | |
A C++ encapsulation of an array and its size.