kumi v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches

◆ member_cast()

template<typename Target, concepts::product_type T>
auto kumi::member_cast ( T && t)
inlinenodiscardconstexpr

Converts a product_type<Ts...> to an instance of a product_type<Target...>.

Template Parameters
Targetdestination type to associate to each member of the product type
Parameters
tProduct type to convert
Returns
A Product type containing the values of b where each member is of type Target

Helper type

namespace kumi::result
{
template<typename Target, product_type T> struct member_cast;
template<typename Target, Product_type T>
using member_cast_t = typename member_cast<Target, T>::type;
}
constexpr auto member_cast(T &&t)
Converts a product_type<Ts...> to an instance of a product_type<Target...>.
Definition cast.hpp:57

Computes the return type of a call to kumi::member_cast

Examples:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
kumi::tuple a = { 14.f, 42, 55, short{89} };
std::cout << a << "\n";
std::cout << b << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:29
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
kumi::record a = { "a"_id = 14.f, "b"_id = 42,"c"_id = 55, "d"_id = short{89} };
std::cout << a << "\n";
std::cout << b << "\n";
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29