12.0.0
-
Optimized the default floating point formatting (https://github.com/fmtlib/fmt/issues/3675, https://github.com/fmtlib/fmt/issues/4516). In particular, formatting a
doublewith format string compilation into a stack allocated buffer is more than 60% faster in version 12.0 compared to 11.2 according to dtoa-benchmark:Function Time (ns) Speedup fmt11 34.471 1.00x fmt12 21.000 1.64x -
Added
constexprsupport tofmt::format. For example:#include <fmt/compile.h> using namespace fmt::literals; std::string s = fmt::format(""_cf, 42);now works at compile time provided that
std::stringsupportsconstexpr(https://github.com/fmtlib/fmt/issues/3403, https://github.com/fmtlib/fmt/pull/4456). Thanks @msvetkin. -
Added
FMT_STATIC_FORMATthat allows formatting into a string of the exact required size at compile time.For example:
#include <fmt/compile.h> constexpr auto s = FMT_STATIC_FORMAT("{}", 42);compiles to just
__ZL1s: .asciiz "42"It can be accessed as a C string with
s.c_str()or as a string view withs.str(). -
Improved C++20 module support (https://github.com/fmtlib/fmt/pull/4451, https://github.com/fmtlib/fmt/pull/4459, https://github.com/fmtlib/fmt/pull/4476, https://github.com/fmtlib/fmt/pull/4488, https://github.com/fmtlib/fmt/issues/4491, https://github.com/fmtlib/fmt/pull/4495). Thanks @arBmind, @tkhyn, @Mishura4, @anonymouspc and @autoantwort.
-
Switched to using estimated display width in precision. For example:
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. -
Fix interaction between debug presentation, precision, and width for strings (https://github.com/fmtlib/fmt/pull/4478). Thanks @localspook.
-
Implemented allocator propagation on
basic_memory_buffermove (https://github.com/fmtlib/fmt/issues/4487, https://github.com/fmtlib/fmt/pull/4490). Thanks @toprakmurat. -
Fixed an ambiguity between
std::reference_wrapper<T>andformat_asformatters (https://github.com/fmtlib/fmt/issues/4424, https://github.com/fmtlib/fmt/pull/4434). Thanks @jeremy-rifkin. -
Removed the following deprecated APIs:
has_formatter: useis_formattableinstead,basic_format_args::parse_context_type,basic_format_args::formatter_typeand similar aliases in context types,- wide stream overload of
fmt::printf, - wide stream overloads of
fmt::printthat take text styles, is_*chartraits, -fmt::localtime.
-
Deprecated wide overloads of
fmt::fprintfandfmt::sprintf. -
Improved diagnostics for the incorrect usage of
fmt::ptr(https://github.com/fmtlib/fmt/pull/4453). Thanks @TobiSchluter. -
Made handling of ANSI escape sequences more efficient (https://github.com/fmtlib/fmt/pull/4511, https://github.com/fmtlib/fmt/pull/4528). Thanks @localspook and @Anas-Hamdane.
-
Fixed a buffer overflow on all emphasis flags set (https://github.com/fmtlib/fmt/pull/4498). Thanks @dominicpoeschko.
-
Fixed an integer overflow for precision close to the max
intvalue. -
Fixed compatibility with WASI (https://github.com/fmtlib/fmt/issues/4496, https://github.com/fmtlib/fmt/pull/4497). Thanks @whitequark.
-
Fixed
back_insert_iteratordetection, preventing a fallback on slower path that handles arbitrary iterators (https://github.com/fmtlib/fmt/issues/4454). -
Fixed handling of invalid glibc
FILEbuffers (https://github.com/fmtlib/fmt/issues/4469). -
Added
wchar_tsupport to thestd::byteformatter (https://github.com/fmtlib/fmt/issues/4479, https://github.com/fmtlib/fmt/pull/4480). Thanks @phprus. -
Changed component prefix from
fmt-tofmt_for compatibility with NSIS/CPack on Windows, e.g.fmt-docchanged tofmt_doc(https://github.com/fmtlib/fmt/issues/4441, https://github.com/fmtlib/fmt/pull/4442). Thanks @n-stein. -
Added the
FMT_CUSTOM_ASSERT_FAILmacro to simplify providing a customfmt::assert_failimplementation (https://github.com/fmtlib/fmt/pull/4505). Thanks @HazardyKnusperkeks. -
Switched to
FMT_THROWon reporting format errors so that it can be overriden by users when exceptions are disabled (https://github.com/fmtlib/fmt/pull/4521). Thanks @HazardyKnusperkeks. -
Improved master project detection and disabled install targets when using {fmt} as a subproject by default (https://github.com/fmtlib/fmt/pull/4536). Thanks @crueter.
-
Made various code improvements (https://github.com/fmtlib/fmt/pull/4445, https://github.com/fmtlib/fmt/pull/4448, https://github.com/fmtlib/fmt/pull/4473, https://github.com/fmtlib/fmt/pull/4522). Thanks @localspook, @tchaikov and @way4sahil.
-
Added Conan instructions to the docs (https://github.com/fmtlib/fmt/pull/4537). Thanks @uilianries.
-
Removed Bazel files to avoid issues with downstream packaging (https://github.com/fmtlib/fmt/pull/4530). Thanks @mering.
-
Added more entries for generated files to
.gitignore(https://github.com/fmtlib/fmt/pull/4355, https://github.com/fmtlib/fmt/pull/4512). Thanks @dinomight and @localspook. -
Fixed various warnings and compilation issues (https://github.com/fmtlib/fmt/pull/4447, https://github.com/fmtlib/fmt/issues/4470, https://github.com/fmtlib/fmt/pull/4474, https://github.com/fmtlib/fmt/pull/4477, https://github.com/fmtlib/fmt/pull/4471, https://github.com/fmtlib/fmt/pull/4483, https://github.com/fmtlib/fmt/pull/4515, https://github.com/fmtlib/fmt/issues/4533, https://github.com/fmtlib/fmt/pull/4534). Thanks @dodomorandi, @localspook, @remyjette, @Tomek-Stolarczyk, @Mishura4, @mattiasljungstrom and @FatihBAKIR.