|
commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
|
User-defined literals for the Commons value types: _color and _icon.
More...


Go to the source code of this file.
Functions | |
| consteval Color | comms::literals::operator""_color (const char *str, const std::size_t len) |
| Compile-time color literal, e.g. | |
| consteval Icon | comms::literals::operator""_icon (const char *str, const std::size_t len) |
| Compile-time icon literal, e.g. | |
User-defined literals for the Commons value types: _color and _icon.
Both live in namespace comms::literals — bring them in with using namespace comms::literals;. Each is consteval, so a malformed literal is a compile error (the throw is never reached in a well-formed constant expression). They are kept out of color.hpp/icon.hpp so a translation unit pays for the literal operators only when it asks for them; the umbrella commons/commons.hpp includes this header.
| consteval Color comms::literals::operator""_color | ( | const char * | str, |
| const std::size_t | len | ||
| ) |
Compile-time color literal, e.g.
"#6366f1"_color. Accepts the hex forms of Color::parse_hex (#rgb, #rgba, #rrggbb, #rrggbbaa, the # optional). Being consteval, a malformed literal is a compile error.
| consteval Icon comms::literals::operator""_icon | ( | const char * | str, |
| const std::size_t | len | ||
| ) |
Compile-time icon literal, e.g.
"mdi:abacus"_icon. Accepts any well-formed Iconify set:name value (see Icon::parse: exactly one :, non-empty parts, within Icon::capacity). Being consteval, a malformed literal is a compile error.