PlayRho  2.0.0
An interactive physics engine & library.
playrho::Span< T > Class Template Reference

An encapsulation of an array and its size. More...

#include <playrho/Span.hpp>

Public Types

using const_pointer = const data_type *
 Constant pointer type.
 
using data_type = T
 Data type.
 
using pointer = data_type *
 Pointer type.
 
using size_type = std::size_t
 Size type.
 

Public Member Functions

template<std::size_t SIZE>
constexpr Span (data_type(&array)[SIZE]) noexcept
 Initializing constructor.
 
constexpr Span (pointer array, size_type size) noexcept
 Initializing constructor.
 
constexpr Span (std::initializer_list< T > list) noexcept
 Initializing constructor.
 
template<typename U >
constexpr Span (U &&value) noexcept
 Initializing constructor.
 
constexpr pointer begin () const noexcept
 Gets the "begin" iterator value.
 
constexpr pointer data () const noexcept
 Direct access to data.
 
constexpr bool empty () const noexcept
 Checks whether this span is empty.
 
constexpr pointer end () const noexcept
 Gets the "end" iterator value.
 
constexpr data_typeoperator[] (size_type index) const noexcept
 Accesses the indexed element.
 
constexpr size_type size () const noexcept
 Gets the size of this span.
 

Detailed Description

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

An encapsulation of an array and its size.

Note
This class is like the C++20 std::span class.
This is also like the Guideline Support Library's span template class.
Todo:
Consider replacing uses of this class with C++20 std::span if/when this project shifts to C++20.
See also
https://en.cppreference.com/w/cpp/container/span/span
http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0122r1.pdf

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