KUMI
v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches
◆
front()
template<concepts::non_empty_product_type T>
decltype(auto) kumi::front
(
T &&
t
)
inline
nodiscard
constexpr
Retrieves the front of a product type.
Parameters
t
Base product type
Returns
A reference to the first element of the product type
t
.
Note
This function does not take part in overload resolution if t is an empty product type.
Helper type
namespace
kumi::result
{
template
<product_type T>
struct
front
;
template
<product_type T>
using
front_t =
typename
front<T>::type
;
}
kumi::front
constexpr decltype(auto) front(T &&t)
Retrieves the front of a product type.
Definition
back-front.hpp:42
Computes the return type of a call to
kumi::front
Examples:
Tuple:
#include <kumi/kumi.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::back
constexpr decltype(auto) back(T &&t)
Retrieves the back of a product type.
Definition
back-front.hpp:78
kumi::tuple
Fixed-size collection of heterogeneous values.
Definition
tuple.hpp:33
Record:
#include <kumi/kumi.hpp>
#include <iostream>
int
main()
{
using namespace
kumi::literals;
kumi::record
x{
"a"
_id = 2.3,
"b"
_id = 18,
"c"
_id = 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::record
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition
record.hpp:36
kumi