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

◆ front()

template<product_type Tuple>
requires ( size_v<Tuple> != 0)
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) kumi::front ( Tuple &&  t)
constexpr

Retrieves the front of a tuple.

Parameters
tBase tuple
Returns
A reference to the first element of the tuple t

Helper type

namespace kumi::result
{
template<product_type Tuple> struct front;
template<product_type Tuple>
using front_t = typename front<Tuple>::type;
}
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) front(Tuple &&t)
Retrieves the front of a tuple.
Definition: back-front.hpp:38

Computes the return type of a call to kumi::front

Example

#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
kumi::tuple x{2.3,18, 5.f};
std::cout << kumi::front(x) << "\n";
std::cout << kumi::back(x) << "\n";
kumi::front(x) = 98.5;
kumi::back(x) = 66.f;
std::cout << x << "\n";
}
KUMI_TRIVIAL_NODISCARD constexpr decltype(auto) back(Tuple &&t)
Retrieves the back of a tuple.
Definition: back-front.hpp:67
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35