Extracts the label of a kumi::concepts::field, or returns the value of kumi::unknown.
More...
|
| template<typename T> |
| consteval kumi_implementation_defined auto | kumi::label_of () noexcept |
Extracts the label of a kumi::concepts::field, or returns the value of kumi::unknown.
◆ label_of()
template<typename T>
| kumi_implementation_defined auto kumi::label_of |
( |
| ) |
|
|
inlinenodiscardconstevalnoexcept |
- Note
- If the unqualified type of input does not model kumi::concepts::field, returns kumi::unknown::value, the kumi::str "kumi::unknown".
- Template Parameters
-
| T | The type to extract label from. |
- Returns
- The label of the field as a kumi::str.
Helper type
namespace kumi::result
{
}
consteval kumi_implementation_defined auto label_of() noexcept
Definition field.hpp:213
Computes the return type of a call to kumi::label_of
Example:
#include <kumi/kumi.hpp>
#include <iostream>
{
friend constexpr auto to_str(my_id) {
return kumi::str{
"Specific label"}; }
};
inline constexpr my_id my_kw{};
int main()
{
using namespace kumi::literals;
auto field = (
"x"_id = 1 );
int standard = { 12 };
auto custom = (my_kw = 255);
std::cout <<
field <<
"\n";
std::cout << kumi::label_of<decltype(field)>() << "\n";
std::cout << standard << "\n";
std::cout << kumi::label_of<decltype(standard)>() << "\n";
std::cout << custom << "\n";
std::cout << kumi::label_of<decltype(custom)>() << "\n";
}
kumi::str constexpr to_str(auto e)
Provides an extension point to_str in order to output types with no textual representation defined.
Named wrapper over a type.
Definition field.hpp:26
identifier definition class
Definition identifier.hpp:89
Static string used to create named fields.
Definition str.hpp:31