|
KUMI v5.0.0
Gorgeous Garnet
|
Fixed-size collection of homogeneous values. More...
#include <kumi/product_types/array.hpp>
Fixed-size collection of homogeneous values.
kumi::array is different from std::array in several aspects. It can hold reference type and it's possible to create an empty kumi::array<> that deduces to kumi::array<void,0>. This is the proper type representation of the identity of power types.
When passed into algorithms, kumi::array can decay to it's more general case that is kumi::tuple if at any point the algorithms would generate heterogeneous types.
kumi::array provides an aggregate based implementation of an array. It provides algorithms and functions designed to facilitate array's handling and transformations.
kumi::array is also compatible with standard tuple operations and structured bindings.
| T | Type stored inside kumi::array. |
| N | Size of the sequence |
Public Member Functions | |
|
template<typename U> requires (std::is_assignable_v<T&, U&&>) | |
| constexpr array & | operator= (array< U, N > &&other) noexcept(std::is_nothrow_assignable_v< T &, U && >) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<typename U> requires (std::is_assignable_v<T&, U const&>) | |
| constexpr array & | operator= (array< U, N > const &other) noexcept(std::is_nothrow_assignable_v< T &, U const & >) |
| Replaces the contents of the array with the contents of another array. | |
| template<std::size_t I> requires (I < N) | |
| constexpr decltype(auto) | operator[] (kumi::index_t< I > i) &noexcept |
| Extracts the Ith element from a kumi::array. | |
|
template<std::size_t I> requires (I < N) | |
| constexpr decltype(auto) | operator[] (kumi::index_t< I >) &&noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
|
template<std::size_t I> requires (I < N) | |
| constexpr decltype(auto) | operator[] (kumi::index_t< I >) const &&noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
|
template<std::size_t I> requires (I < N) | |
| constexpr decltype(auto) | operator[] (kumi::index_t< I >) const &noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Conversions | |
| template<typename U> | |
| explicit (!std::convertible_to< T const &, U >) const expr operator array< U | |
| Enables static casting a array<T,N> to an array<U,N>, the conversions is explicit if the casting requires internal explicit conversions. | |
| template<typename U> | |
| explicit (!std::convertible_to< T &, U >) const expr operator array< U | |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Friends | |
| constexpr void | swap (array &a, array &b) noexcept(std::is_nothrow_swappable_v< T >) |
| Swaps the contents of two kumi::arrays. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename CharT, typename Traits, typename T, std::size_t N> | |
| std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, array< T, N > const &a) noexcept |
| Inserts a kumi::array in an output stream. | |
Comparison operators | |
| template<typename T, typename U, std::size_t N> | |
| constexpr auto | operator== (array< T, N > const &self, array< U, N > const &other) noexcept |
| Compares an array with another for equality. | |
| template<typename T, typename U, std::size_t N> | |
| constexpr auto | operator!= (array< T, N > const &self, array< U, N > const &other) noexcept |
| Compares an array with another for inequality. | |
| template<typename T, typename U, std::size_t N> | |
| constexpr auto | operator< (array< T, N > const &lhs, array< U, N > const &rhs) noexcept |
| Compares arrays for the lexicographical less-than relation. | |
| template<typename T, typename U, std::size_t N> | |
| constexpr auto | operator<= (array< T, N > const &lhs, array< U, N > const &rhs) noexcept |
| Compares arrays for the lexicographical less-than-or-equal relation. | |
| template<typename T, typename U, std::size_t N> | |
| constexpr auto | operator> (array< T, N > const &lhs, array< U, N > const &rhs) noexcept |
| Compares arrays for the lexicographical greater-than relation. | |
| template<typename T, typename U, std::size_t N> | |
| constexpr auto | operator>= (array< T, N > const &lhs, array< U, N > const &rhs) noexcept |
| Compares arrays for the lexicographical greater-than-or-equal relation. | |
Array deduction guides | |
| template<typename T, typename... Ts> | |
| array (T &&, Ts &&...) -> array< std::unwrap_ref_decay_t< T >, sizeof...(Ts)+1 > | |
| kumi::array deduction guide | |
array Accessors | |
| template<std::size_t I, typename T, std::size_t N> | |
| decltype(auto) constexpr | get (array< T, N > &t) noexcept |
| Extracts the Ith element from a kumi::array. | |
| template<std::size_t I, typename T, std::size_t N> | |
| decltype(auto) constexpr | get (array< T, N > &&arg) noexcept |
| template<std::size_t I, typename T, std::size_t N> | |
| decltype(auto) constexpr | get (array< T, N > const &arg) noexcept |
| template<std::size_t I, typename T, std::size_t N> | |
| decltype(auto) constexpr | get (array< T, N > const &&arg) noexcept |
|
inlineexplicit |
Enables static casting a array<T,N> to an array<U,N>, the conversions is explicit if the casting requires internal explicit conversions.
| U | Type of the elements of the destination array |
This permits the conversion from an array<T>& to an array<T&> which makes it suitable for some zip-like cases such as building a structure of arrays iterator.
|
inlineconstexprnoexcept |
Replaces the contents of the array with the contents of another array.
| other | kumi::array to copy or move from |
|
inlineconstexprnoexcept |
Extracts the Ith element from a kumi::array.
| i | Compile-time index of the element to access |
|
kumi::array deduction guide
| Ts | Type lists to build the array with. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
nodiscardinlineconstexprnoexcept |
Extracts the Ith element from a kumi::array.
| I | Compile-time index of the element to access |
| t | array to index |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
Compares arrays for the lexicographical less-than relation.
Swaps the contents of two kumi::arrays.