Formats arguments according to the format string fmt_str and produces a string of the exact required size at compile time. Both the format string and the arguments must be compile‐time expressions.

Synopsis

Declared in <fmt/compile.h>

#define FMT_STATIC_FORMAT(fmt_str, …​)

Description

The resulting string can be accessed as a C string via c_str() or as a fmt::string_view via str().

Example:

// Produces the static string "42" at compile time. static constexpr auto result = FMT_STATIC_FORMAT("{}", 42); const char* s = result.c_str();

Created with MrDocs