![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
A backport of std::span for C++14. Provides a view over a contiguous range of elements of type T.
More...

Public Types | |
| using | const_iterator = detail::wrapped_iterator<const_pointer, span_detail::span_iter_passkey> |
| The type of an iterator into a const view of the data viewed by the span. | |
| using | const_pointer = T const* |
The type of pointers to const elements of the span. | |
| using | const_reference = T const& |
The type of references to const elements of the span. | |
| using | const_reverse_iterator = ::arene::base::reverse_iterator<const_iterator> |
| The type of an iterator into a const and reversed view of the data viewed by the span. | |
| using | difference_type = typename iterator::difference_type |
| The type used for obtaining differences between iterators of the span. | |
| using | element_type = T |
| The type of the elements of the span. | |
| using | iterator = detail::wrapped_iterator<pointer, span_detail::span_iter_passkey> |
| The type of an iterator into the data viewed by the span. | |
| using | pointer = T* |
| The type of pointers to elements of the span. | |
| using | reference = T& |
| The type of references to elements of the span. | |
| using | reverse_iterator = ::arene::base::reverse_iterator<iterator> |
| The type of an iterator into a reversed view of the data viewed by the span. | |
| using | size_type = std::size_t |
| The type of the size of the span. | |
| using | value_type = arene::base::remove_cvref_t<T> |
The type of the elements of the span without const or volatile qualification. | |
Public Member Functions | |
| constexpr | span () noexcept=default |
Default-constructs an empty span. Only exists if Extent==dynamic_extent or Extent==0. | |
| template<template< typename U, std::size_t N > class ArrayLikeT, typename U, std::size_t N, constraints< std::enable_if_t< span_detail::has_member_data_v< ArrayLikeT< U, N > > >, std::enable_if_t< span_detail::has_tuple_size_v< ArrayLikeT< U, N > > >, std::enable_if_t< std::tuple_size< ArrayLikeT< U, N > >::value==N >, std::enable_if_t< arene::base::is_array_convertible_v< U, T > >, std::enable_if_t< is_valid_source_extent_v< N > > > = nullptr> | |
| constexpr | span (ArrayLikeT< U, N > &&array) noexcept |
Constructor from an rvalue std::array -like type. | |
| template<template< typename U, std::size_t N > class ArrayLikeT, typename U, std::size_t N, constraints< std::enable_if_t< span_detail::has_member_data_v< ArrayLikeT< U, N > > >, std::enable_if_t< span_detail::has_tuple_size_v< ArrayLikeT< U, N > > >, std::enable_if_t< std::tuple_size< ArrayLikeT< U, N > >::value==N >, std::enable_if_t< arene::base::is_array_convertible_v< U, T > >, std::enable_if_t< is_valid_source_extent_v< N > > > = nullptr> | |
| constexpr | span (ArrayLikeT< U, N > &array) noexcept |
Constructor from a std::array. | |
| template<template< typename U, std::size_t N > class ArrayLikeT, typename U, std::size_t N, constraints< std::enable_if_t< span_detail::has_member_data_v< ArrayLikeT< U, N > > >, std::enable_if_t< span_detail::has_tuple_size_v< ArrayLikeT< U, N > > >, std::enable_if_t< std::tuple_size< ArrayLikeT< U, N > >::value==N >, std::enable_if_t< std::is_const< T >::value &&arene::base::is_array_convertible_v< U, T > >, std::enable_if_t< is_valid_source_extent_v< N > > > = nullptr> | |
| constexpr | span (ArrayLikeT< U, N > const &&array) noexcept |
Constructor from an const rvalue std::array -like type. | |
| template<template< typename U, std::size_t N > class ArrayLikeT, typename U, std::size_t N, constraints< std::enable_if_t< span_detail::has_member_data_v< ArrayLikeT< U, N > > >, std::enable_if_t< span_detail::has_tuple_size_v< ArrayLikeT< U, N > > >, std::enable_if_t< std::tuple_size< ArrayLikeT< U, N > >::value==N >, std::enable_if_t< std::is_const< T >::value &&arene::base::is_array_convertible_v< U, T > >, std::enable_if_t< is_valid_source_extent_v< N > > > = nullptr> | |
| constexpr | span (ArrayLikeT< U, N > const &array) noexcept |
Constructor from a const std::array -like type. | |
| template<typename Container, constraints< std::enable_if_t< !span_detail::has_tuple_size_v< arene::base::remove_cvref_t< Container > > &&span_detail::is_dynamic_extent(Extent)>, std::enable_if_t< arene::base::is_array_convertible_v< arene::base::remove_reference_t< >, T > > > = nullptr> | |
| constexpr | span (Container &&source) noexcept |
| Constructor from a container of T with contiguous elements. | |
| template<typename Container, constraints< std::enable_if_t< !span_detail::has_tuple_size_v< arene::base::remove_cvref_t< Container > > &&!span_detail::is_dynamic_extent(Extent)>, std::enable_if_t< arene::base::is_array_convertible_v< arene::base::remove_reference_t< >, T > > > = nullptr> | |
| constexpr | span (Container &&source) noexcept |
| Constructor from a container of T with contiguous elements. | |
| constexpr | span (span &&other)=default |
| default move constructor | |
| constexpr | span (span const &other)=default |
| default copy constructor | |
| template<typename U, std::size_t OtherExtent, constraints< std::enable_if_t< !span_detail::is_dynamic_extent(Extent) &&!span_detail::is_dynamic_extent(OtherExtent) &&Extent !=OtherExtent > > = nullptr> | |
| constexpr | span (span< U, OtherExtent > &&other) noexcept=delete |
| Disable construction of fixed size spans from other spans of mismatched size. | |
| template<typename U, std::size_t OtherExtent, constraints< std::enable_if_t< arene::base::is_array_convertible_v< U, T > >, std::enable_if_t< is_valid_source_extent_v< OtherExtent > > > = nullptr> | |
| constexpr | span (span< U, OtherExtent > const &other) noexcept |
Constructor from another span<U,OtherExtent> when Extent is "no more restrictive" then OtherExtent. | |
| template<typename U, std::size_t OtherExtent, constraints< std::enable_if_t< arene::base::is_array_convertible_v< U, T > >, std::enable_if_t<(!span_detail::is_dynamic_extent(Extent)) &&span_detail::is_dynamic_extent(OtherExtent)> > = nullptr> | |
| constexpr | span (span< U, OtherExtent > const &other) noexcept |
Constructor from span<U,dynamic_extent> when Extent is not dynamic_extent . | |
| template<std::size_t N, constraints< std::enable_if_t< is_valid_source_extent_v< N > > > = nullptr> | |
| constexpr | span (T(&array)[N]) noexcept |
| Constructor from a c-array. | |
| template<typename U, constraints< std::enable_if_t< arene::base::is_array_convertible_v< U, T > > > = nullptr> | |
| constexpr | span (U *data_pointer, std::size_t data_size) noexcept |
| Construct with the specified data and size. Prevents implicit derived-to-base pointer conversions on the supplied data argument. | |
| ~span ()=default | |
| default destructor | |
| ARENE_NODISCARD constexpr auto | back () const noexcept -> T & |
| Access the last element in the span. | |
| ARENE_NODISCARD constexpr auto | begin () const noexcept -> iterator |
| Obtain an iterator to the beginning of the data viewed by the span. | |
| ARENE_NODISCARD constexpr auto | cbegin () const noexcept -> const_iterator |
| Obtain a const_iterator to the beginning of the data viewed by the span. | |
| ARENE_NODISCARD constexpr auto | cend () const noexcept -> const_iterator |
| Obtain a const_iterator to the one-past-the-end of the data viewed by the span. | |
| ARENE_NODISCARD constexpr auto | crbegin () const noexcept -> const_reverse_iterator |
| Obtain a const_iterator to the beginning of a reversed view of the data in the span. | |
| ARENE_NODISCARD constexpr auto | crend () const noexcept -> const_reverse_iterator |
| Obtain a const iterator to one-past-the-end of a reversed view of the data in the span. | |
| ARENE_NODISCARD constexpr auto | data () const noexcept -> T * |
| Accessor to the underlying data as a raw pointer. | |
| ARENE_NODISCARD constexpr auto | empty () const noexcept -> bool |
| Predicate to test if the span views onto non-zero elements. | |
| ARENE_NODISCARD constexpr auto | end () const noexcept -> iterator |
| Obtain an iterator to the one-past-the-end of the data viewed by the span. | |
| template<std::size_t Count, std::size_t UE = Extent, constraints< std::enable_if_t< span_detail::is_dynamic_extent(UE)> > = nullptr> | |
| ARENE_NODISCARD constexpr auto | first () const noexcept -> span< T, Count > |
| Create a new fixed-size span from the beginning of the span. | |
| template<std::size_t Count, std::size_t UE = Extent> | |
| ARENE_NODISCARD constexpr auto | first () const noexcept -> span< T, Count > |
| Create a new fixed-size span from the beginning of the span. | |
| ARENE_NODISCARD constexpr auto | first (std::size_t count) const noexcept -> span< T > |
| Create a new dynamic-size span from the beginning of the span. | |
| ARENE_NODISCARD constexpr auto | front () const noexcept -> T & |
| Access the first element in the span. | |
| template<std::size_t Count, std::size_t UE = Extent, constraints< std::enable_if_t< span_detail::is_dynamic_extent(UE)> > = nullptr> | |
| ARENE_NODISCARD constexpr auto | last () const noexcept -> span< T, Count > |
Create a new fixed-size span for the last Count elements. | |
| template<std::size_t Count, std::size_t UE = Extent> | |
| ARENE_NODISCARD constexpr auto | last () const noexcept -> span< T, Count > |
Create a new fixed-size span for the last Count elements. | |
| ARENE_NODISCARD constexpr auto | last (std::size_t count) const noexcept -> span< T > |
Create a new dynamic-size span for the last count elements. | |
| constexpr auto | operator= (span &&other) -> span &=default |
| default move assignment operator | |
| constexpr auto | operator= (span const &other) -> span &=default |
| default copy assignment operator | |
| constexpr auto | operator[] (std::size_t index) const noexcept -> T & |
| Retrieve the element at the specified index into the span. index must be less than size() | |
| ARENE_NODISCARD constexpr auto | rbegin () const noexcept -> reverse_iterator |
| Obtain an iterator to the beginning of a reversed view of the data in the span. | |
| ARENE_NODISCARD constexpr auto | rend () const noexcept -> reverse_iterator |
| Obtain an iterator to one-past-the-end of a reversed view of the data in the span. | |
| ARENE_NODISCARD constexpr auto | size_bytes () const noexcept -> std::size_t |
| Returns the total size in bytes of the elements in the span. | |
| ARENE_NODISCARD constexpr auto | ssize () const noexcept -> difference_type |
| The size of the span as a signed integer. | |
| template<std::size_t Offset, std::size_t Count = span_detail::get_dynamic_extent()> | |
| ARENE_NODISCARD constexpr auto | subspan () const noexcept -> span< T, span_detail::extent_for_subspan< Extent, Offset, Count >()> |
| Creates a new fixed-size span which is a slice of this span. | |
| template<std::size_t Offset, std::size_t Count = span_detail::get_dynamic_extent()> | |
| ARENE_NODISCARD constexpr auto | subspan () const noexcept -> span< T, span_detail::extent_for_subspan< Extent, Offset, Count >()> |
| Creates a new fixed-size span which is a slice of this span. | |
| template<std::size_t Offset, std::size_t Count = span_detail::get_dynamic_extent()> | |
| ARENE_NODISCARD constexpr auto | subspan () const noexcept -> span< T, span_detail::extent_for_subspan< Extent, Offset, Count >()> |
| Creates a new dynamic-sized span which is a slice of this span. | |
| template<std::size_t Offset, std::size_t Count = span_detail::get_dynamic_extent()> | |
| ARENE_NODISCARD constexpr auto | subspan () const noexcept -> span< T, span_detail::extent_for_subspan< Extent, Offset, Count >()> |
| Creates a new fixed-size span which is a slice of this span. | |
| ARENE_NODISCARD constexpr auto | subspan (std::size_t offset, std::size_t count=dynamic_extent) const noexcept -> span< T > |
| Creates a new dynamic-size span which is a slice of this span. | |
Static Public Attributes | |
| static constexpr std::integral_constant< std::size_t, Extent > | extent {} |
| The Extent of the span — either dynamic_extent, or the fixed size. | |
A backport of std::span for C++14. Provides a view over a contiguous range of elements of type T.
| T | The type of the element the span views |
| Extent | The size of the span. If set to arene::base::dynamic_extent , then the Size of the range is determined at runtime. Otherwise the range of elements is exactly Extent elements. |
| using arene::base::span< T, Extent >::const_iterator = detail::wrapped_iterator<const_pointer, span_detail::span_iter_passkey> |
The type of an iterator into a const view of the data viewed by the span.
| using arene::base::span< T, Extent >::const_pointer = T const* |
The type of pointers to const elements of the span.
| using arene::base::span< T, Extent >::const_reference = T const& |
The type of references to const elements of the span.
| using arene::base::span< T, Extent >::const_reverse_iterator = ::arene::base::reverse_iterator<const_iterator> |
The type of an iterator into a const and reversed view of the data viewed by the span.
| using arene::base::span< T, Extent >::difference_type = typename iterator::difference_type |
The type used for obtaining differences between iterators of the span.
| using arene::base::span< T, Extent >::element_type = T |
The type of the elements of the span.
| using arene::base::span< T, Extent >::iterator = detail::wrapped_iterator<pointer, span_detail::span_iter_passkey> |
The type of an iterator into the data viewed by the span.
| using arene::base::span< T, Extent >::pointer = T* |
The type of pointers to elements of the span.
| using arene::base::span< T, Extent >::reference = T& |
The type of references to elements of the span.
| using arene::base::span< T, Extent >::reverse_iterator = ::arene::base::reverse_iterator<iterator> |
The type of an iterator into a reversed view of the data viewed by the span.
| using arene::base::span< T, Extent >::size_type = std::size_t |
The type of the size of the span.
| using arene::base::span< T, Extent >::value_type = arene::base::remove_cvref_t<T> |
The type of the elements of the span without const or volatile qualification.
|
constexprdefaultnoexcept |
Default-constructs an empty span. Only exists if Extent==dynamic_extent or Extent==0.
size()==0 .
|
constexprdefault |
default copy constructor
| other | The span being copied |
|
constexprdefault |
default move constructor
| other | The span being moved |
|
default |
default destructor
|
inlineconstexprnoexcept |
Construct with the specified data and size. Prevents implicit derived-to-base pointer conversions on the supplied data argument.
| U | The type of the data to convert from. |
| data_pointer | The data from which to construct the span. |
| data_size | The size of the data span to construct. |
data_pointer+data_size must be in the valid range of data_pointer , else behavior is undefined. data_size must satisfy is_valid_runtime_size else ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Constructor from a std::array.
| ArrayLikeT | The template-template type of the array-like container. A container is array-like if it has a member function data() and std::tuple_size<ArrayLikeType<U,N>> is defined. |
| U | The value_type of the array. Must satisfy is_array_convertible_v<U,T> |
| N | The size of the array, Must satisfy is_valid_source_extent |
| array | The array to construct the span from |
size()==N . data()==array.data() .
|
inlineconstexprnoexcept |
Constructor from a const std::array -like type.
| ArrayLikeT | The template-template type of the array-like container. A container is array-like if it has a member function data() and std::tuple_size<ArrayLikeType<U,N>> is defined. |
| U | The value_type of the array. Must satisfy is_array_convertible_v<const U, T> |
| N | The size of the array, Must satisfy is_valid_source_extent |
| array | The array to construct the span from |
size()==N . data()==array.data() .
|
inlineconstexprnoexcept |
Constructor from an rvalue std::array -like type.
| ArrayLikeT | The template-template type of the array-like container. A container is array-like if it has a member function data() and std::tuple_size<ArrayLikeType<U,N>> is defined. |
| U | The value_type of the array. Must satisfy is_array_convertible_v<const U, T> |
| N | The size of the array, Must satisfy is_valid_source_extent |
| array | The array to construct the span from |
size()==N . data()==array.data() .
|
inlineconstexprnoexcept |
Constructor from an const rvalue std::array -like type.
| ArrayLikeT | The template-template type of the array-like container. A container is array-like if it has a member function data() and std::tuple_size<ArrayLikeType<U,N>> is defined. |
| U | The value_type of the array. Must satisfy is_array_convertible_v<const U, T> |
| N | The size of the array, Must satisfy is_valid_source_extent |
| array | The array to construct the span from |
size()==N . data()==array.data() .
|
constexprdeletenoexcept |
Disable construction of fixed size spans from other spans of mismatched size.
| other | The source object |
|
inlineconstexprnoexcept |
Constructor from a container of T with contiguous elements.
| Container | the type of the container to construct from. A "container" is a type which has data() and size() member functions, where data() returns a pointer (or equivalent) to contiguous memory containing elements pointer-convertible to T . |
| source | The container to construct the span from |
Extent is not dynamic_extent , then source.size()==Extent must be true, else it is an ARENE_PRECONDITION violation.
|
inlineexplicitconstexprnoexcept |
Constructor from a container of T with contiguous elements.
| Container | the type of the container to construct from. A "container" is a type which has data() and size() member functions, where data() returns a pointer (or equivalent) to contiguous memory containing elements pointer-convertible to T . |
| source | The container to construct the span from |
Extent is not dynamic_extent , then source.size()==Extent must be true, else it is an ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
Constructor from another span<U,OtherExtent> when Extent is "no more restrictive" then OtherExtent.
| U | The type of the element in the other span. Must be pointer-convertible to T |
| OtherExten | If Extent is not dynamic_extent , then must be equal to Extent . |
| other | The span to construct from. |
|
inlineexplicitconstexprnoexcept |
Constructor from span<U,dynamic_extent> when Extent is not dynamic_extent .
| U | The type of the element in the other span. Must be pointer-convertible to T |
| other | The span to construct from. |
span.size()==Extent , else ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
Access the last element in the span.
empty() must be false, else ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
Obtain an iterator to the beginning of the data viewed by the span.
|
inlineconstexprnoexcept |
Obtain a const_iterator to the beginning of the data viewed by the span.
|
inlineconstexprnoexcept |
Obtain a const_iterator to the one-past-the-end of the data viewed by the span.
cbegin()+size() .
|
inlineconstexprnoexcept |
Obtain a const_iterator to the beginning of a reversed view of the data in the span.
const_reverse_iterator(cend())
|
inlineconstexprnoexcept |
Obtain a const iterator to one-past-the-end of a reversed view of the data in the span.
const_reverse_iterator(cbegin())
|
inlineconstexprnoexcept |
Accessor to the underlying data as a raw pointer.
|
inlineconstexprnoexcept |
Predicate to test if the span views onto non-zero elements.
size() == 0.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Create a new fixed-size span from the beginning of the span.
| Count | The number of elements to include. |
| UE | dummy parameter for SFINAE. |
Count<=size() . else ARENE_PRECONDITION violation. Count elements from the span.
|
inlineconstexprnoexcept |
Create a new fixed-size span from the beginning of the span.
| Count | The number of elements to include. Must be <=Extent . |
Count elements from the span.
|
inlineconstexprnoexcept |
Create a new dynamic-size span from the beginning of the span.
| count | The number of elements to include. |
count must be <= size() . else ARENE_PRECONDITION violation. count elements from the span.
|
inlineconstexprnoexcept |
Access the first element in the span.
empty() must be false, else ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
Create a new fixed-size span for the last Count elements.
| Count | The number of elements to include. |
Count<=size() , else ARENE_PRECONDITION violation. Count elements from the span.
|
inlineconstexprnoexcept |
Create a new fixed-size span for the last Count elements.
| Count | The number of elements to include. Must be <=Extent . |
Count elements from the span.
|
inlineconstexprnoexcept |
Create a new dynamic-size span for the last count elements.
| count | The number of elements to include. |
count must be <= size() . else ARENE_PRECONDITION violation. count elements from the span.
|
constexprdefault |
default move assignment operator
| other | The span being moved |
|
constexprdefault |
default copy assignment operator
| other | The span being copied |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Obtain an iterator to the beginning of a reversed view of the data in the span.
reverse_iterator(end())
|
inlineconstexprnoexcept |
Obtain an iterator to one-past-the-end of a reversed view of the data in the span.
reverse_iterator(begin())
|
inlineconstexprnoexcept |
Returns the total size in bytes of the elements in the span.
|
inlineconstexprnoexcept |
The size of the span as a signed integer.
|
inlineconstexprnoexcept |
Creates a new fixed-size span which is a slice of this span.
| Offset | The index of the first element to contain in the subspan. Must be <=Extent |
| Count | The number of elements to include in the subspan. Must satisfy Offset+Count<=Extent , or be dynamic_extent . |
last<Extent-Offset>() .
|
inlineconstexprnoexcept |
Creates a new fixed-size span which is a slice of this span.
| Offset | The index of the first element to contain in the subspan. Must be <=Extent |
| Count | The number of elements to include in the subspan. Must satisfy Offset+Count<=Extent , or be dynamic_extent . |
last<Extent-Offset>().first<Count>() .
|
inlineconstexprnoexcept |
Creates a new dynamic-sized span which is a slice of this span.
| Offset | The index of the first element to contain in the subspan. Must be <= size() |
| Count | The number of elements to include in the subspan. offset + count must be <= size() |
last(size()-Offset) .
|
inlineconstexprnoexcept |
Creates a new fixed-size span which is a slice of this span.
| Offset | The index of the first element to contain in the subspan. Must be <= size() |
| Count | The number of elements to include in the subspan. offset + count must be <= size() |
last(size()-Offset).first<Count>() .
|
inlineconstexprnoexcept |
Creates a new dynamic-size span which is a slice of this span.
| offset | The index of the first element to contain in the subspan. Must be <= size() |
| count | The number of elements to include in the subspan. offset + count must be <= size() |
|
staticconstexpr |
The Extent of the span — either dynamic_extent, or the fixed size.