Template Struct FixedName

Nested Relationships

Nested Types

Template Parameter Order

  1. size_t N

Struct Documentation

template<size_t N>
struct FixedName

Fixed-size, null-terminated string container.

Template Parameters:

N – Maximum size of the buffer (including the null terminator).

Public Functions

FixedName() = default

Default constructor for FixedName.

template<size_t M>
inline constexpr FixedName(const char (&str)[M])

Constructs a FixedName from a string literal.

Parameters:

str – The input string literal.

inline bool operator==(const FixedName &other) const

Equality operator for FixedName.

Parameters:

other – Another FixedName object.

Returns:

true if equal, false otherwise.

inline auto operator<=>(const FixedName &other) const

Three-way comparison operator for FixedName.

Parameters:

other – Another FixedName object.

Returns:

std::strong_ordering result of the comparison.

inline explicit operator std::string_view() const

Converts FixedName to std::string_view.

Returns:

std::string_view of the FixedName.

inline const char *c_str() const

Get a c-style string view from the buffer.

Returns:

const char* of the FixedName

inline std::optional<FixedName> operator+(std::string_view other) const

Concatenates two FixedName objects.

Parameters:

other – Another FixedName object.

Returns:

std::optional<FixedName> containing the concatenated result, or std::nullopt if the result exceeds the buffer size.

inline bool operator+=(std::string_view other)

Appends a string_view to the current FixedName.

Parameters:

other – The string_view to append.

Returns:

bool True if the operation was successful, false otherwise.

Public Members

std::array<char, N> buf = {}
size_t len = {}

Public Static Functions

static inline std::optional<FixedName> init(std::string_view str)

Initializes a FixedName from a string view.

Parameters:

str – The input string view.

Returns:

std::optional<FixedName> containing the initialized FixedName, or std::nullopt if the input string exceeds the buffer size.

struct glaze

Provides a string view for serialization.

Public Static Attributes

static constexpr auto value = [](const FixedName& self) -> auto { return std::string_view(self.buf.data(), self.len); }