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

◆ from_tuple

template<typename Type>
from_tuple_t<Type> kumi::from_tuple {}
inlineconstexprnodiscard

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

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

Header file

#include <kumi/product_types/tuple.hpp>

Call Signature

template<typename Type, product_type T>
constexpr auto from_tuple(T&& t);

Parameters

Return value

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

Example

#include <kumi/kumi.hpp>
#include <iostream>
#include <string>
struct my_struct
{
int i;
float f;
std::string name;
};
int main()
{
auto a = kumi::make_tuple(1337, 2.3475f, "John");
std::cout << a << "\n";
std::cout << b.i << ' ' << b.f << ' ' << b.name << "\n";
}
Compile-time text based identifier.
Definition identifier.hpp:162