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

◆ get()

template<std::size_t I, typename... Ts>
decltype(auto) constexpr get ( tuple< Ts... > &  t)
related

Extracts the Ith element from a kumi::tuple.

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

Example:

#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
kumi::tuple t = { 1, 2.3, 4.5f, '@' };
std::cout << kumi::get<0>(t) << "\n";
std::cout << kumi::get<1>(t) << "\n";
std::cout << kumi::get<2>(t) << "\n";
kumi::get<3>(t)++;
std::cout << kumi::get<3>(t) << "\n";
}
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35