![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
Specialize for zero-sized arrays as 'T array[0]' is not standards compliant. More...
Public Types | |
| using | const_iterator |
An iterator for the array that treats the elements as const. | |
| using | const_iterator = typename span<T const, 0>::iterator |
An iterator for the array that treats the elements as const. | |
| using | const_pointer |
| The type of a pointer to a const array element. | |
| using | const_pointer = T const* |
| The type of a pointer to a const array element. | |
| using | const_reference |
| The type of a reference to a const array element. | |
| using | const_reference = T const& |
| The type of a reference to a const array element. | |
| using | const_reverse_iterator |
An iterator for iteration through the array in reverse order that treats the elements as const. | |
| using | const_reverse_iterator = typename span<T, 0>::const_reverse_iterator |
An iterator for iteration through the array in reverse order that treats the elements as const. | |
| using | difference_type |
| The type for the distance between two iterators. | |
| using | difference_type = std::ptrdiff_t |
| The type for the distance between two iterators. | |
| using | iterator |
| An iterator for the array. | |
| using | iterator = typename span<T, 0>::iterator |
| An iterator for the array. | |
| using | pointer |
| The type of a pointer to an array element. | |
| using | pointer = T* |
| The type of a pointer to an array element. | |
| using | reference |
| The type of a reference to an array element. | |
| using | reference = T& |
| The type of a reference to an array element. | |
| using | reverse_iterator |
| An iterator for iteration through the array in reverse order. | |
| using | reverse_iterator = typename span<T, 0>::reverse_iterator |
| An iterator for iteration through the array in reverse order. | |
| using | size_type |
The type returned by size() | |
| using | size_type = std::size_t |
The type returned by size() | |
| using | value_type |
| The type of each array element. | |
| using | value_type = T |
| The type of each array element. | |
Public Member Functions | |
| constexpr auto | at (std::size_t index) -> T & |
| Get a reference to the n'th element of the array, or throw. | |
| constexpr auto | at (std::size_t index) const -> T const & |
| Get a reference to the n'th element of the array, or throw. | |
| template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr> | |
| ARENE_NORETURN constexpr auto | at (std::size_t) -> T & |
| Get a reference to the index'th element of the array. | |
| template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr> | |
| ARENE_NORETURN constexpr auto | at (std::size_t) const -> T const & |
| Get a const-reference to the index'th element of the array. | |
| constexpr auto | back () const noexcept -> T const & |
| Get a const-reference to the last element of the array. | |
| ARENE_NORETURN constexpr auto | back () const noexcept -> T const & |
| Get a const-reference to the last element of the array. | |
| constexpr auto | back () noexcept -> T & |
| Get a const-reference to the last element of the array. | |
| ARENE_NORETURN constexpr auto | back () noexcept -> T & |
| Get a const-reference to the last element of the array. | |
| constexpr auto | begin () const noexcept -> const_iterator |
| Obtain an iterator to the first element of the array. | |
| constexpr auto | begin () const noexcept -> const_iterator |
| Get a const_iterator that references the first element of the array. | |
| constexpr auto | begin () noexcept -> iterator |
| Obtain an iterator to the first element of the array. | |
| constexpr auto | begin () noexcept -> iterator |
| Get an iterator that references the first element of the array. | |
| constexpr auto | cbegin () const noexcept -> const_iterator |
Obtain a const_iterator that references the first element of the array. | |
| constexpr auto | cend () const noexcept -> const_iterator |
Obtain a const_iterator that references one past the last element of the array. | |
| constexpr auto | crbegin () const noexcept -> const_reverse_iterator |
Obtain a const_reverse_iterator that references the last element of the array. | |
| constexpr auto | crend () const noexcept -> const_reverse_iterator |
Obtain a const_reverse_iterator that references one before the first element of the array. | |
| constexpr auto | data () const noexcept -> T const * |
| Obtain a pointer to the first element of the array. | |
| constexpr auto | data () const noexcept -> T const * |
| Get a pointer to the first element of the const array. | |
| constexpr auto | data () noexcept -> T * |
| Obtain a pointer to the first element of the array. | |
| constexpr auto | data () noexcept -> T * |
| Get a pointer to the first element of the array. | |
| constexpr auto | end () const noexcept -> const_iterator |
| Obtain an iterator to the one-passed-the-end of the array. | |
| constexpr auto | end () const noexcept -> const_iterator |
| Get a const_iterator that references one past the last element of the array. | |
| constexpr auto | end () noexcept -> iterator |
| Obtain an iterator to the one-passed-the-end of the array. | |
| constexpr auto | end () noexcept -> iterator |
| Get an iterator that references one-past the last element of the array. | |
| constexpr void | fill (T const &val) noexcept(std::is_nothrow_copy_assignable< T >::value) |
| Set every element in the array to the provided value. | |
| constexpr auto | front () const noexcept -> T const & |
| Get a const-reference to the first element of the array. | |
| ARENE_NORETURN constexpr auto | front () const noexcept -> T const & |
| Get a const-reference to the first element of the array. | |
| constexpr auto | front () noexcept -> T & |
| Get a reference to the first element of the array. | |
| ARENE_NORETURN constexpr auto | front () noexcept -> T & |
| Get a const-reference to the first element of the array. | |
| constexpr auto | operator[] (std::size_t index) const noexcept -> T const & |
| Get a reference to the n'th element of the array. | |
| constexpr auto | operator[] (std::size_t index) noexcept -> T & |
| Get a reference to the n'th element of the array. | |
| constexpr auto | rbegin () const noexcept -> const_reverse_iterator |
| Obtain a reverse_iterator to the last element of the array. | |
| constexpr auto | rbegin () const noexcept -> const_reverse_iterator |
| Get a const_reverse_iterator that references the last element of the array. | |
| constexpr auto | rbegin () noexcept -> reverse_iterator |
| Obtain a reverse_iterator to the last element of the array. | |
| constexpr auto | rbegin () noexcept -> reverse_iterator |
| Get an reverse_iterator that references the last element of the array. | |
| constexpr auto | rend () const noexcept -> const_reverse_iterator |
Obtai a const_reverse_iterator that references one before the first element of the array. | |
| constexpr auto | rend () const noexcept -> const_reverse_iterator |
| Get a const_reverse_iterator that references one before the first element of the array. | |
| constexpr auto | rend () noexcept -> reverse_iterator |
Obtain a reverse_iterator that references one-before the first element of the array. | |
| constexpr auto | rend () noexcept -> reverse_iterator |
| Get an reverse_iterator that references one-before the first element of the array. | |
| constexpr void | swap (array &) noexcept |
| Swap all the elements with another array. This is a noop for an empty array. | |
| constexpr void | swap (array &other) noexcept(is_nothrow_swappable_v< U >) |
| swaps all the elements this array and another. | |
| ARENE_NORETURN constexpr auto | operator[] (std::size_t) noexcept -> T & |
| Get a reference to the index'th element of the array. | |
| ARENE_NORETURN constexpr auto | operator[] (std::size_t) const noexcept -> T const & |
| Get a reference to the index'th element of the array. | |
Static Public Member Functions | |
| static constexpr auto | cbegin () noexcept -> const_iterator |
| Get a const_iterator that references the first element of the array. | |
| static constexpr auto | cend () noexcept -> const_iterator |
| Get a const_iterator that references one past the last element of the array. | |
| static constexpr auto | crbegin () noexcept -> const_reverse_iterator |
| Get a const_reverse_iterator that references the last element of the array. | |
| static constexpr auto | crend () noexcept -> const_reverse_iterator |
| Get a const_reverse_iterator that references one before the first element of the array. | |
| static constexpr auto | fast_inequality_check (array const &lhs, array< T, UN > const &rhs) noexcept -> arene::base::inequality_heuristic |
| Quickly checks two arrays for inequality to see if a more costly full ordering check is needed. | |
| static constexpr void | fill (T const &) noexcept |
| Set every element in the array to the provided value. This is a noop for an empty array. | |
| static constexpr auto | three_way_compare (array const &lhs, array< T, UN > const &rhs) noexcept -> arene::base::strong_ordering |
| Imparts a lexicographic ordering of two arrays. | |
| static constexpr auto | three_way_compare (array const &, array< T, 0 > const &) noexcept -> arene::base::strong_ordering |
| Imparts a lexicographic ordering of two arrays. | |
Public Attributes | |
| T | values_ [N] |
The actual elements of the array object. This must be a public member to allow aggregate initialization, but users should treat it as private, and only use the documented public interface. | |
Static Public Attributes | |
| static constexpr std::integral_constant< bool, false > | empty |
Check if the array is empty, always false. | |
| static constexpr std::integral_constant< bool, true > | empty {} |
Check if the array is empty, always true. | |
| static constexpr std::integral_constant< std::size_t, N > | max_size |
The maximum number of elements in the array, which is always N. | |
| static constexpr std::integral_constant< std::size_t, 0 > | max_size {} |
| The maximum number of elements in the array, which is always 0. | |
| static constexpr std::integral_constant< std::size_t, N > | size |
The number of elements in the array, which is always N. | |
| static constexpr std::integral_constant< std::size_t, 0 > | size {} |
| The number of elements in the array, which is always 0. | |
Friends | |
| constexpr auto | operator!= (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Inequality compare all elements in the array. | |
| constexpr void | swap (array &, array &) noexcept |
| Swap all the elements with another array. This is a noop for an empty array. | |
| constexpr void | swap (array &lhs, array &rhs) noexcept(noexcept(lhs.swap(rhs))) |
| swaps all the elements between two arrays. | |
| constexpr auto | operator== (array const &lhs, array const &rhs) noexcept -> bool |
| Equality compare all elements in the array. | |
| constexpr auto | operator== (array const &, array< T, UN > const &) noexcept -> bool |
| Equality compare all elements in the array. | |
| constexpr auto | operator== (array const &lhs, array const &rhs) noexcept -> bool |
| Equality compare all elements in the array. | |
| constexpr auto | operator== (array const &lhs, array const &rhs) noexcept -> bool |
| Equality compare all elements in the array. | |
| constexpr auto | operator== (array const &, array< T, UN > const &) noexcept -> bool |
| Equality compare all elements in the array. | |
| constexpr auto | operator< (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Imparts a lexicographic ordering of two arrays. | |
| constexpr auto | operator<= (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Imparts a lexicographic ordering of two arrays. | |
| constexpr auto | operator> (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Imparts a lexicographic ordering of two arrays. | |
| constexpr auto | operator>= (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Imparts a lexicographic ordering of two arrays. | |
| template<std::size_t UN> | |
| static constexpr auto | three_way_compare (array const &, array< T, UN > const &) noexcept -> arene::base::strong_ordering |
| Compares two arrays lexicographically. | |
| template<std::size_t UN> | |
| constexpr auto | operator== (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Compares two arrays lexicographically. | |
| template<std::size_t UN> | |
| constexpr auto | operator!= (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Compares two arrays lexicographically. | |
| template<std::size_t UN> | |
| constexpr auto | operator< (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Compares two arrays lexicographically. | |
| template<std::size_t UN> | |
| constexpr auto | operator<= (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Compares two arrays lexicographically. | |
| template<std::size_t UN> | |
| constexpr auto | operator> (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Compares two arrays lexicographically. | |
| template<std::size_t UN> | |
| constexpr auto | operator>= (array const &lhs, array< T, UN > const &rhs) noexcept -> bool |
| Compares two arrays lexicographically. | |
Specialize for zero-sized arrays as 'T array[0]' is not standards compliant.
| using arene::base::array< T, N >::const_iterator |
An iterator for the array that treats the elements as const.
| using arene::base::array< T, 0 >::const_iterator = typename span<T const, 0>::iterator |
An iterator for the array that treats the elements as const.
| using arene::base::array< T, N >::const_pointer |
The type of a pointer to a const array element.
| using arene::base::array< T, 0 >::const_pointer = T const* |
The type of a pointer to a const array element.
| using arene::base::array< T, N >::const_reference |
The type of a reference to a const array element.
| using arene::base::array< T, 0 >::const_reference = T const& |
The type of a reference to a const array element.
| using arene::base::array< T, N >::const_reverse_iterator |
An iterator for iteration through the array in reverse order that treats the elements as const.
| using arene::base::array< T, 0 >::const_reverse_iterator = typename span<T, 0>::const_reverse_iterator |
An iterator for iteration through the array in reverse order that treats the elements as const.
| using arene::base::array< T, N >::difference_type |
The type for the distance between two iterators.
| using arene::base::array< T, 0 >::difference_type = std::ptrdiff_t |
The type for the distance between two iterators.
| using arene::base::array< T, N >::iterator |
An iterator for the array.
| using arene::base::array< T, 0 >::iterator = typename span<T, 0>::iterator |
An iterator for the array.
| using arene::base::array< T, N >::pointer |
The type of a pointer to an array element.
| using arene::base::array< T, 0 >::pointer = T* |
The type of a pointer to an array element.
| using arene::base::array< T, N >::reference |
The type of a reference to an array element.
| using arene::base::array< T, 0 >::reference = T& |
The type of a reference to an array element.
| using arene::base::array< T, N >::reverse_iterator |
An iterator for iteration through the array in reverse order.
| using arene::base::array< T, 0 >::reverse_iterator = typename span<T, 0>::reverse_iterator |
An iterator for iteration through the array in reverse order.
| using arene::base::array< T, N >::size_type |
The type returned by size()
| using arene::base::array< T, 0 >::size_type = std::size_t |
The type returned by size()
| using arene::base::array< T, N >::value_type |
The type of each array element.
| using arene::base::array< T, 0 >::value_type = T |
The type of each array element.
|
inlineconstexpr |
Get a reference to the n'th element of the array, or throw.
| AreExceptionsEnabled | SFINAE flag to disable this method if exceptions are not enabled. Should not be specified by the user. |
| index | The index of the element to access. |
| std::out_of_range | If index is not less than N |
|
inlineconstexpr |
Get a reference to the n'th element of the array, or throw.
| AreExceptionsEnabled | Defaulted SFINAE flag to disable this method if exceptions are not enabled; should not be specified by user. |
| index | The index of the element to access. |
| std::out_of_range | If index is not less than N |
|
inlineconstexpr |
Get a reference to the index'th element of the array.
| AreExceptionsEnabled | Defaulted SFINAE flag to disable this method if exceptions are not enabled; should not be specified by user. |
| std::out_of_range | unconditionally |
|
inlineconstexpr |
Get a const-reference to the index'th element of the array.
| AreExceptionsEnabled | Defaulted SFINAE flag to disable this method if exceptions are not enabled; should not be specified by user. |
| std::out_of_range |
|
inlineconstexprnoexcept |
Get a const-reference to the last element of the array.
|
inlineconstexprnoexcept |
Get a const-reference to the last element of the array.
|
inlineconstexprnoexcept |
Get a const-reference to the last element of the array.
|
inlineconstexprnoexcept |
Get a const-reference to the last element of the array.
|
inlineconstexprnoexcept |
Obtain an iterator to the first element of the array.
const_iterator that references the first element of the array.
|
inlineconstexprnoexcept |
Get a const_iterator that references the first element of the array.
|
inlineconstexprnoexcept |
Obtain an iterator to the first element of the array.
iterator that references the first element of the array.
|
inlineconstexprnoexcept |
Get an iterator that references the first element of the array.
|
inlineconstexprnoexcept |
Obtain a const_iterator that references the first element of the array.
const_iterator that references the first element of the array.
|
inlinestaticconstexprnoexcept |
Get a const_iterator that references the first element of the array.
|
inlineconstexprnoexcept |
Obtain a const_iterator that references one past the last element of the array.
const_iterator that references one past the last element of the array.
|
inlinestaticconstexprnoexcept |
Get a const_iterator that references one past the last element of the array.
|
inlineconstexprnoexcept |
Obtain a const_reverse_iterator that references the last element of the array.
const_reverse_iterator that references the last element of the array.
|
inlinestaticconstexprnoexcept |
Get a const_reverse_iterator that references the last element of the array.
|
inlineconstexprnoexcept |
Obtain a const_reverse_iterator that references one before the first element of the array.
const_reverse_iterator that references one before the first element of the array.
|
inlinestaticconstexprnoexcept |
Get a const_reverse_iterator that references one before the first element of the array.
|
inlineconstexprnoexcept |
Obtain a pointer to the first element of the array.
|
inlineconstexprnoexcept |
Get a pointer to the first element of the const array.
|
inlineconstexprnoexcept |
Obtain a pointer to the first element of the array.
|
inlineconstexprnoexcept |
Get a pointer to the first element of the array.
|
inlineconstexprnoexcept |
Obtain an iterator to the one-passed-the-end of the array.
const_iterator that references one past the last element of the array.
|
inlineconstexprnoexcept |
Get a const_iterator that references one past the last element of the array.
|
inlineconstexprnoexcept |
Obtain an iterator to the one-passed-the-end of the array.
iterator that references one-past the last element of the array.
|
inlineconstexprnoexcept |
Get an iterator that references one-past the last element of the array.
|
inlinestaticconstexprnoexcept |
Quickly checks two arrays for inequality to see if a more costly full ordering check is needed.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
arene::base::inequality_heuristic::definitely_not_equal if the two arrays have different sizes or if any pair of their elements compare definitely_not_equal arene::base::inequality_heuristic::may_be_equal_or_not_equal otherwise
|
inlinestaticconstexprnoexcept |
Set every element in the array to the provided value. This is a noop for an empty array.
|
inlineconstexprnoexcept |
Set every element in the array to the provided value.
| val | The value to use |
|
inlineconstexprnoexcept |
Get a const-reference to the first element of the array.
|
inlineconstexprnoexcept |
Get a const-reference to the first element of the array.
|
inlineconstexprnoexcept |
Get a reference to the first element of the array.
|
inlineconstexprnoexcept |
Get a const-reference to the first element of the array.
|
inlineconstexprnoexcept |
Get a reference to the n'th element of the array.
| index | The index of the element to access. |
index Must be less than N or else ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
Get a reference to the n'th element of the array.
| index | The index of the element to access. |
index Must be less than N or else ARENE_PRECONDITION violation.
|
inlineconstexprnoexcept |
Get a reference to the index'th element of the array.
ARENE_PRECONDITION
|
inlineconstexprnoexcept |
Get a reference to the index'th element of the array.
ARENE_PRECONDITION
|
inlineconstexprnoexcept |
Obtain a reverse_iterator to the last element of the array.
const_reverse_iterator that references the last element of the array.
|
inlineconstexprnoexcept |
Get a const_reverse_iterator that references the last element of the array.
|
inlineconstexprnoexcept |
Obtain a reverse_iterator to the last element of the array.
reverse_iterator that references the last element of the array.
|
inlineconstexprnoexcept |
Get an reverse_iterator that references the last element of the array.
|
inlineconstexprnoexcept |
Obtai a const_reverse_iterator that references one before the first element of the array.
const_reverse_iterator that references one before the first element of the array.
|
inlineconstexprnoexcept |
Get a const_reverse_iterator that references one before the first element of the array.
|
inlineconstexprnoexcept |
Obtain a reverse_iterator that references one-before the first element of the array.
reverse_iterator that references one-before the first element of the array.
|
inlineconstexprnoexcept |
Get an reverse_iterator that references one-before the first element of the array.
|
inlineconstexprnoexcept |
Swap all the elements with another array. This is a noop for an empty array.
|
inlineconstexprnoexcept |
swaps all the elements this array and another.
| U | the type of the elements in the array. Must satisfy is_swappable_v . |
| other | the array to swap elements with |
other are exchanged 1:1. Relative order is maintained.
|
inlinestaticconstexprnoexcept |
Imparts a lexicographic ordering of two arrays.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
rhs and lhs also compares less-than, or if lhs is a strict prefix of rhs. rhs and lhs also compares greater, or if rhs is a strict prefix of lhs.
|
inlinestaticconstexprnoexcept |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN)
|
inlinestaticconstexprnoexcept |
Imparts a lexicographic ordering of two arrays.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
rhs and lhs also compares less-than, or if lhs is a strict prefix of rhs. rhs and lhs also compares greater, or if rhs is a strict prefix of lhs. Inequality compare all elements in the array.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
|
friend |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN) Imparts a lexicographic ordering of two arrays.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
|
friend |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN) Imparts a lexicographic ordering of two arrays.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
|
friend |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN) Equality compare all elements in the array.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
Equality compare all elements in the array.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
Equality compare all elements in the array.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
Equality compare all elements in the array.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
Equality compare all elements in the array.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
|
friend |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN) Imparts a lexicographic ordering of two arrays.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
|
friend |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN) Imparts a lexicographic ordering of two arrays.
| lhs | one of the arrays to compare |
| rhs | the other array to compare |
|
friend |
Compares two arrays lexicographically.
| lhs | The left hand operand to the comparison. |
| rhs | The right hand operand to the comparison. |
compare_three_way{}(0U,UN) Swap all the elements with another array. This is a noop for an empty array.
swaps all the elements between two arrays.
| U | the type of the elements in the array. Must satisfy is_swappable_v . |
| lhs | the left hand array to swap. |
| rhs | the right hand array to swap. |
lhs and rhs are exchanged 1:1. Relative order is maintained.
|
staticconstexpr |
Check if the array is empty, always false.
|
staticconstexpr |
Check if the array is empty, always true.
|
staticconstexpr |
The maximum number of elements in the array, which is always N.
|
staticconstexpr |
The maximum number of elements in the array, which is always 0.
|
staticconstexpr |
The number of elements in the array, which is always N.
|
staticconstexpr |
The number of elements in the array, which is always 0.
| T arene::base::array< T, N >::values_[N] |
The actual elements of the array object. This must be a public member to allow aggregate initialization, but users should treat it as private, and only use the documented public interface.