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

◆ to_ref()

template<product_type Type>
KUMI_TRIVIAL_NODISCARD constexpr auto to_ref ( Type &&  t)
related

Creates a kumi::tuple of references given a reference to a kumi::product_type.

Parameters
tCompile-time index of the element to access
Returns
A tuple equivalent to the result of kumi::apply([]<typename... T>(T&&... e) { return kumi::forward_as_tuple(std::forward<T>(e)...); }, t)

Example:

#include <kumi/tuple.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";
}