template<typename T, template< typename... > class Meta = std::type_identity>
struct kumi::as_array< T, Meta >
Generate a kumi::array type from a type.
If T is a kumi::concepts::product_type, returns the kumi::array type containing the same element as T. Otherwise, it returns kumi::array<T>.
A template meta-function can be optionally passed to be applied to each of those types when types are computed.
- Template Parameters
-
| T | Type to transform |
| Meta | Unary template meta-function to apply to each types. Defaults to std::type_identity |
Helper type
{
template<typename T, template<typename...> class Meta = std::type_identity>
}
Main KUMI namespace.
Definition algorithm.hpp:11
Generate a kumi::array type from a type.
Definition array.hpp:626
Example:
#include <kumi/kumi.hpp>
#include <cstdint>
#include <type_traits>
int main()
{
using three_floats = kumi::as_array_t<kumi::array<float, 3>>;
using three_pointers = kumi::as_array_t<kumi::array<float, 3>, std::add_pointer>;
using single_float = kumi::as_array_t<float>;
static_assert( std::same_as<three_floats , kumi::array<float, 3> >);
static_assert( std::same_as<three_pointers, kumi::array<float*, 3> >);
static_assert( std::same_as<single_float , kumi::array<float, 0> >);
}