Template Struct ct_string

Struct Documentation

template<std::size_t N>
struct ct_string

Fixed-size compile-time string.

Holds N+1 chars with a guaranteed @0’terminator atdata[N]` when constructed from a C string or produced by the provided helpers.

Template Parameters:

N – Number of characters (not counting the trailing NUL).

Public Functions

constexpr ct_string() = default

Default-construct with zero-initialized storage.

inline constexpr ct_string(const char (&str)[N + 1])

Construct from a C string literal of length N.

inline constexpr const char *c_str() const

C-string pointer to the internal buffer (NUL-terminated).

inline constexpr std::size_t size() const

Length excluding the terminator.

inline constexpr operator std::string_view() const

Implicit view of the first N characters (excludes the terminator).

Public Members

std::array<char, N + 1> data = {}

Storage including trailing NUL.