KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ member_cast

template<typename T>
member_cast_t<T> kumi::member_cast {}
inlineconstexprnodiscard

Callable object converting a product_type<Ts...> to an instance of a product_type<Target...>.

Header file

#include <kumi/algorithm/member_cast.hpp>

Call Signature

template<typename Target, product_type T>
constexpr auto member_cast<Target>(T && t) noexcept;
constexpr member_cast_t< T > member_cast
Callable object converting a product_type<Ts...> to an instance of a product_type<Target....
Definition cast.hpp:83

Template Parameters

  • Target: destination type to associate to each member of the product type t

Parameters

  • t: Product Type to convert

Return value

  • A Product type containing the values of t where each member is of type Target

Helper type

template<typename Target, kumi::concepts::product_type T> struct member_cast
{
using type = decltype(kumi::member_cast<Target>(std::declval<T>()));
};
template<typename Target, kumi::concepts::product_type T>
using member_cast_t = typename kumi::result::member_cast<Target, T>::type;

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

Examples

Tuple

#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:33

Record

#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 tagged fields, tags are unique.
Definition record.hpp:36