23template <std::
size_t N>
35 std::copy_n(str, N,
value.begin());
44 consteval auto size() const noexcept -> std::
size_t {
54 consteval auto data() const noexcept -> const
char* {
66 consteval auto view() const noexcept -> std::string_view {
77 constexpr auto operator[](std::size_t i)
const noexcept ->
char {
91template <std::
size_t N>
StringLiteral(const char(&)[N]) -> StringLiteral< N >
Deduction guide: StringLiteral("hello") deduces StringLiteral<6>.
Compile-time string type usable as a non-type template parameter.
consteval auto size() const noexcept -> std::size_t
Returns the string length excluding the null terminator.
consteval auto operator==(const StringLiteral &) const noexcept -> bool=default
Equality comparison (compares the underlying arrays).
consteval auto view() const noexcept -> std::string_view
Returns a std::string_view over the stored characters.
consteval auto data() const noexcept -> const char *
Returns a raw pointer to the first character.
std::array< char, N > value
Raw character storage (null-terminated, length N).
consteval StringLiteral(const char(&str)[N]) noexcept
Constructs from a C string literal, copying all N characters.
constexpr auto operator[](std::size_t i) const noexcept -> char
Returns the character at index i.