|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
A structural, NTTP-capable compile-time string. More...
#include <fixed_string.hpp>
Public Member Functions | |
| constexpr | FixedString (const char(&literal)[N]) noexcept |
| Captures a string literal. | |
| constexpr std::string_view | view () const noexcept |
| A view of the string (without the terminating null). | |
Public Attributes | |
| std::array< char, N > | data {} |
| Character storage (null-terminated). | |
A structural, NTTP-capable compile-time string.
A literal type with public array storage, so it satisfies the rules for a non-type template parameter. Two FixedString values of the same length with the same characters compare equal as template arguments, so a type parameterised on a FixedString written identically in two translation units is one and the same type.
This is the single canonical definition. The forms layer aliases it twice — as morph::forms::FixedString (used by Choice) and as morph::forms::detail::LiteralString (which captures an equals rule literal) — and the units layer once, as morph::units::detail::FixedString (used by NamedQuantity). None of them redefine their own copy.
| N | Storage size including the terminating null. |
Definition at line 33 of file fixed_string.hpp.
|
inlineconstexprnoexcept |
Captures a string literal.
constexpr, not consteval: as an NTTP this is still only ever evaluated at compile time (that context demands it regardless), but constexpr additionally lets a function parameter of type const char (&)[N] be captured — morph::forms::equals(&A::code, "X") forwards its literal exactly that way, and a consteval constructor cannot be called with a reference parameter, which is not itself a constant expression.
| literal | The literal to copy, e.g. "ListSamples". |
Definition at line 54 of file fixed_string.hpp.
|
inlinenodiscardconstexprnoexcept |
A view of the string (without the terminating null).
Definition at line 64 of file fixed_string.hpp.
| std::array<char, N> morph::detail::FixedString< N >::data {} |
Character storage (null-terminated).
Definition at line 35 of file fixed_string.hpp.