5.2.0
版本发布时间: 2018-09-13 22:35:31
fmtlib/fmt最新发布版本:11.0.2(2024-07-20 22:32:04)
-
Optimized format string parsing and argument processing which resulted in up to 5x speed up on long format strings and significant performance boost on various benchmarks. For example, version 5.2 is 2.22x faster than 5.1 on decimal integer formatting with
format_to
(macOS, clang-902.0.39.2):Method Time, s Speedup fmt::format 5.1 0.58 fmt::format 5.2 0.35 1.66x fmt::format_to 5.1 0.51 fmt::format_to 5.2 0.23 2.22x sprintf 0.71 std::to_string 1.01 std::stringstream 1.73 -
Changed the
fmt
macro from opt-out to opt-in to prevent name collisions. To enable it define theFMT_STRING_ALIAS
macro to 1 before includingfmt/format.h
:#define FMT_STRING_ALIAS 1 #include <fmt/format.h> std::string answer = format(fmt("{}"), 42);
-
Added compile-time format string checks to
format_to
overload that takesfmt::memory_buffer
(#783):fmt::memory_buffer buf; // Compile-time error: invalid type specifier. fmt::format_to(buf, fmt("{:d}"), "foo");
-
Moved experimental color support to
fmt/color.h
and enabled the new API by default. The old API can be enabled by defining theFMT_DEPRECATED_COLORS
macro. -
Added formatting support for types explicitly convertible to
fmt::string_view
:struct foo { explicit operator fmt::string_view() const { return "foo"; } }; auto s = format("{}", foo());
In particular, this makes formatting function work with
folly::StringPiece
. -
Implemented preliminary support for
char*_t
by replacing theformat
function overloads with a single function template parameterized on the string type. -
Added support for dynamic argument lists (#814, #819). Thanks @MikePopoloski (Michael Popoloski).
-
Reduced executable size overhead for embedded targets using newlib nano by making locale dependency optional (#839). Thanks @teajay-fr (Thomas Benard).
-
Keep
noexcept
specifier when exceptions are disabled (#801, #810). Thanks @qis (Alexej Harm). -
Fixed formatting of user-defined types providing
operator<<
withformat_to_n
(#806). Thanks @mkurdej (Marek Kurdej). -
Fixed dynamic linkage of new symbols (#808).
-
Fixed global initialization issue (#807):
// This works on compilers with constexpr support. static const std::string answer = fmt::format("{}", 42);
-
Fixed various compiler warnings and errors (#804, #809, #811, #822, #827, #830, #838, #843, #844, #851, #852, #854). Thanks @henryiii (Henry Schreiner), @medithe, and @eliasdaler (Elias Daler).
1、 fmt-5.2.0.zip 1023KB