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

◆ make_record()

template<typename... Ts>
auto kumi::make_record ( Ts &&... ts) -> record< std::unwrap_ref_decay_t< Ts >... > requires(concepts::entirely_uniquely_named< Ts... >)
inlinenodiscardconstexpr

Creates a record object, deducing the target type from the types of arguments.

Parameters
tsZero or more lvalue arguments to construct the record from.
Returns
A kumi::record constructed from the ts or their inner references when ts is an instance of std::reference_wrapper.

Example:

#include <kumi/kumi.hpp>
#include <functional>
#include <iostream>
int main()
{
using namespace kumi::literals;
int k = 99;
auto t = kumi::make_record( "x"_id = 1, "y"_id = 2.3, "z"_id = 4.5f, "t"_id = '@', "m"_id = std::ref(k));
std::cout << t << "\n";
// Reference access
kumi::get<"m"_id>(t)++;
std::cout << k << "\n";
}
decltype(auto) constexpr get(record< Ts... > &r) noexcept
Extracts the Ith field from a kumi::record.
Definition record.hpp:604