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

◆ field_value_of()

template<typename T>
decltype(auto) kumi::field_value_of ( T && t)
inlinenodiscardconstexprnoexcept

Extracts the value from a kumi::concepts::field or returns the parameter.

Note
If the unqualified type of input does not model kumi::concepts::field, simply forwards the parameter
Template Parameters
TThe type to extract the value from<.
Parameters
tA forwarding reference to the input object.
Returns
A forwarded value of the unwrapped object.

Helper type

namespace kumi::result
{
template<typename Ts> struct field_value_of;
template<typename T> using field_value_of_t = typename field_value_of<T>::type;
}
constexpr decltype(auto) field_value_of(T &&t) noexcept
Extracts the value from a kumi::concepts::field or returns the parameter.
Definition field.hpp:220

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

Example:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto field = ( "x"_id = 1 );
int standard = { 12 };
std::cout << field << "\n";
std::cout << kumi::field_value_of(field) << "\n";
std::cout << standard << "\n";
std::cout << kumi::field_value_of(standard) << "\n";
}
Named wrapper over a type.
Definition field.hpp:26