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

◆ to_ref

to_ref_t kumi::to_ref {}
inlineconstexprnoexceptnodiscard

Callable object creating a kumi::concepts::product_type of references given a reference to a kumi::concepts::product_type.

If the input type matches the kumi::concepts::record_type protocol, return a kumi::record, returns a kumi::tuple otherwise.

Header file

#include <kumi/tuple.hpp>

Call Signature

template<product_type T>
constexpr decltype(auto) to_ref(T && t) noexcept;

Parameters

  • t: Product Type whose elements are to be referenced.

Return value

Examples

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto original = kumi::make_tuple(0,'0',0.f);
auto ref = kumi::to_ref( original );
std::cout << original << "\n";
kumi::get<0>(ref) = 9;
kumi::get<1>(ref) = 'z';
kumi::get<2>(ref) = 3.14159f;
std::cout << original << "\n";
}
decltype(auto) constexpr get(record< Ts... > &r) noexcept
Extracts the Ith field from a kumi::record.
Definition record.hpp:766