Download Latest Version 12.0.0 source code.tar.gz (709.1 kB)
Email in envelope

Get an email when there's a new version of fmt

Home / 12.0.0
Name Modified Size InfoDownloads / Week
Parent folder
fmt-12.0.0.zip 2025-09-17 1.4 MB
12.0.0 source code.tar.gz 2025-09-17 709.1 kB
12.0.0 source code.zip 2025-09-17 764.2 kB
README.md 2025-09-17 6.2 kB
Totals: 4 Items   2.9 MB 8

Function Time (ns) Speedup fmt11 34.471 1.00x fmt12 21.000 1.64x

  • Added constexpr support to fmt::format. For example:

```c++ #include <fmt/compile.h>

using namespace fmt::literals; std::string s = fmt::format(""_cf, 42); ```

now works at compile time provided that std::string supports constexpr (https://github.com/fmtlib/fmt/issues/3403, https://github.com/fmtlib/fmt/pull/4456). Thanks @msvetkin.

  • Added FMT_STATIC_FORMAT that allows formatting into a string of the exact required size at compile time.

For example:

```c++ #include <fmt/compile.h>

constexpr auto s = FMT_STATIC_FORMAT("{}", 42); ```

compiles to just

s __ZL1s: .asciiz "42"

It can be accessed as a C string with s.c_str() or as a string view with s.str().

c++ fmt::print("|{:.4}|\n|1234|\n", "🐱🐱🐱");

prints

because 🐱 has an estimated width of 2 (https://github.com/fmtlib/fmt/issues/4272, https://github.com/fmtlib/fmt/pull/4443, https://github.com/fmtlib/fmt/pull/4475). Thanks @nikhilreddydev and @localspook.

Source: README.md, updated 2025-09-17