PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::Span< T > Class Template Reference

A C++ encapsulation of an array and its size. More...

#include <Span.hpp>

Collaboration diagram for playrho::Span< T >:
[legend]

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 &copy)=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_typeoperator[] (size_type index) noexcept
 Accesses the indexed element.
 
const data_typeoperator[] (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.
 

Detailed Description

template<typename T>
class playrho::Span< T >

A C++ encapsulation of an array and its size.

Note
This is conceptually like the Guideline Support Library's span template class.
See also
http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0122r1.pdf

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