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

◆ tie_as_record

template<kumi::concepts::identifier auto... Fields>
tie_as_record_t<Fields...> kumi::tie_as_record {}
inlineconstexprnodiscard

Creates a kumi::record of lvalue references to its arguments.

Header file

#include <kumi/product_types/record.hpp>

Call Signature

template<kumi::concepts::identifier auto... Fields, typename... Ts>
constexpr auto tie_as_record(Ts&... ts);
Concept specifying a type represents an identifier.
Definition concepts.hpp:185

Parameters

  • Fields : Non type template parameters names to associate with each element.
  • ts: Zero or more lvalue arguments to construct the record from.

Return value

Example

#include <kumi/kumi.hpp>
#include <iostream>
using namespace kumi::literals;
auto generate()
{
return kumi::record{"i"_id = 1,"d"_id = 2.3,"f"_id = 4.56f};
}
int main()
{
int i;
double d;
float f;
kumi::tie_as_record<"i"_id, "d"_id, "f"_id>( i,d,f ) = generate();
std::cout << i << " " << d << " " << f << "\n";
}
constexpr generate_t< N > generate
Callable object creating a kumi::tuple containing N applications of the f Callable.
Definition generate.hpp:99
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36