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

◆ make_record

make_record_t kumi::make_record {}
inlineconstexprnodiscard

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

Header file

#include <kumi/product_types/record.hpp>

Call Signature

template<typename... Ts>
constexpr auto make_record(Ts&&... ts);

Parameters

  • ts: Zero or more arguments to construct the record from.

Return value

  • A kumi::record constructed from the arguments or their inner references when an argument 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:766