commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
Loading...
Searching...
No Matches
comms::FixedString< N > Struct Template Reference

Compile-time fixed-size string usable as a non-type template parameter. More...

#include <fixed_string.hpp>

Public Member Functions

constexpr FixedString () noexcept=default
 Default-constructs an all-‘’\0'string.
 
constexpr FixedString (const char(&str)[N]) noexcept
 Implicit by design: enables Event<"foo"> literal syntax.
 

Public Attributes

char value [N] {}
 Character storage, including the trailing null terminator.
 

Detailed Description

template<std::size_t N>
struct comms::FixedString< N >

Compile-time fixed-size string usable as a non-type template parameter.

Construct via CTAD from a string literal:

FixedString id{"order.created"};   // N = 14 (includes null terminator)

The class is a structural type so it can appear directly in template argument lists, e.g. Event<"order.created">.

Constructor & Destructor Documentation

◆ FixedString()

template<std::size_t N>
constexpr comms::FixedString< N >::FixedString ( )
constexprdefaultnoexcept

Default-constructs an all-‘’\0'string.

Present so the type stays default-constructible — required by nlohmann/json'sfrom_jsonpath (seecommons/json.hpp`).


The documentation for this struct was generated from the following file: