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

◆ get() [8/16]

template<std::size_t I, typename... Ts>
decltype(auto) constexpr get ( record< Ts... > & r)
relatednodiscardinlineconstexprnoexcept

Extracts the Ith field from a kumi::record.

Note
Does not participate in overload resolution if I is not in [0, sizeof...(Ts)).
Template Parameters
ICompile-time index of the field to access
Parameters
rRecord to index
Returns
A reference to the selected field of t.

Example:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
kumi::record r = { "x"_id = 1, "y"_id = 2.3, "z"_id = 4.5f, "t"_id = '@' };
std::cout << kumi::get<0>(r) << "\n";
std::cout << kumi::get<1>(r) << "\n";
std::cout << kumi::get<2>(r) << "\n";
kumi::get<3>(r).value++;
std::cout << kumi::get<3>(r) << "\n";
}
decltype(auto) constexpr get(record< Ts... > &r) noexcept
Extracts the Ith field from a kumi::record.
Definition record.hpp:604
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36