KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches

Converts a kumi::array to an instance of an arbitrary type. More...

Variables

template<typename Type>
constexpr from_array_t< Type > kumi::from_array {}

Detailed Description

Converts a kumi::array to an instance of an arbitrary type.

Variable Documentation

◆ from_array

template<typename Type>
from_array_t<Type> kumi::from_array {}
inlineconstexprnodiscard

Constructs an instance of Type by passing elements of t to the appropriate constructor.

Header file

#include <kumi/kumi.hpp>

Call Signature

namespace kumi
{
template<typename Type, concepts::product_type T>
constexpr auto from_array(T&& t);
}
constexpr from_array_t< Type > from_array
Definition array.hpp:523
Main KUMI namespace.
Definition algorithm.hpp:11

Parameters

Return value

  • An instance of Type constructed from each element of t in order.

Example

#include <kumi/kumi.hpp>
#include <iostream>
struct point3
{
int x;
int y;
int z;
};
int main()
{
kumi::array<int, 3> a = { 1, 2, 3 };
auto p = kumi::from_array<point3>( a );
std::cout << p.x << ' ' << p.y << ' ' << p.z << "\n";
}
Fixed-size collection of homogeneous values.
Definition array.hpp:43