KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches
kumi::field< Id, T > Struct Template Reference

Specialisation to clearly indicate an error. More...

#include <kumi/utils/field.hpp>

Detailed Description

template<typename Id, typename T>
requires (std::is_empty_v<T> && !std::is_final_v<T>)
struct kumi::field< Id, T >

Specialisation to clearly indicate an error.

Static Public Member Functions

static constexpr auto label ()
 Name associated to the field.

(Note that these are not member symbols.)

decltype(auto) constexpr capture_field (T &&t) noexcept
decltype(auto) constexpr field_cast (T &&t) noexcept
template<typename CharT, typename Traits>
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, field const &w) noexcept
 Inserts a kumi::field in an output stream.

◆ capture_field()

decltype(auto) constexpr capture_field ( T && t)
related
Template Parameters
NameThe label to associate to the field.
Parameters
tA forwarding reference to the input object.
Returns
A field that correctly keeps the qualified input type.

Helper type

namespace kumi::result
{
template<typename Ts> struct capture_field;
template<typename T> using capture_field_t = typename capture_field<T>::type;
}
decltype(auto) constexpr capture_field(T &&t) noexcept
Definition field.hpp:284

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

Example:

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

◆ field_cast()

decltype(auto) constexpr field_cast ( T && t)
related
Note
If the type to convert models kumi::concepts::field, the function does not rename the input parameter.
Template Parameters
UThe type to convert the parameter to.
Parameters
tA forwarding reference to the input object.
Returns
A value of type U.

Helper type

namespace kumi::result
{
template<typename Ts> struct field_cast;
template<typename T> using field_cast_t = typename field_cast<T>::type;
}
decltype(auto) constexpr field_cast(T &&t) noexcept
Definition field.hpp:320

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

Example:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto field = ( "x"_id = 'x' );
using caster_t = decltype( "y"_id = 1 );
std::cout << field << "\n";
std::cout << kumi::field_cast<int>(field) << "\n";
std::cout << kumi::field_cast<caster_t>(field) << "\n";
}