From 612669d343ed234c2c2dc76f2a41123f1692d7de Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 4 Aug 2019 07:28:48 -0700 Subject: [PATCH] Update changelog --- ChangeLog.rst | 70 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/ChangeLog.rst b/ChangeLog.rst index 59b8f83a..6ca48108 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -1,7 +1,7 @@ 6.0.0 - TBD ----------- -* Made floating-point formatting locale-independent: +* Floating-point formatting is now locale-independent: .. code:: c++ @@ -24,18 +24,66 @@ prints "value = 4,2". -* Introduced the ``fmt::compile`` function that does format string compilation: +* ``formatter`` specializations now always take precedence over ``operator<<`` + (`#952 `_): + + .. code:: c++ + + #include + #include + + struct S {}; + + std::ostream& operator<<(std::ostream& os, S) { + return os << 1; + } + + template <> + struct fmt::formatter : fmt::formatter { + auto format(S, format_context& ctx) { + return formatter::format(2, ctx); + } + }; + + int main() { + std::cout << S() << "\n"; // prints 1 using operator<< + fmt::print("{}\n", S()); // prints 2 using formatter + } + +* Introduced the experimental ``fmt::compile`` function that does format string + compilation (`#618 `_): .. code:: c++ #include auto f = fmt::compile("{}"); - std::string s = f.format(42); // can be called multiple times to format - // different values + std::string s = fmt::format(f, 42); // can be called multiple times to format + // different values // s == "42" - Thanks `@stryku (Mateusz Janek) `_. + It moves the cost of parsing a format string outside of the format function + which can be beneficial when identically formatting many objects of the same + types. Thanks `@stryku (Mateusz Janek) `_. + +* Implemented precision for floating-point durations + (`#1004 `_, + `#1012 `_): + + .. code:: c++ + + auto s = fmt::format("{:.1}", std::chrono::duration(1.234)); + // s == 1.2s + + Thanks `@DanielaE (Daniela Engert) `_. + +* Implemented ``chrono`` format specifiers ``%Q`` and ``%q`` that give the value + and the unit respectively (`#1019 `_): + + auto value = fmt::format("{:%Q}", 42s); // value == "42" + auto unit = fmt::format("{:%q}", 42s); // unit == "s" + + Thanks `@DanielaE (Daniela Engert) `_. * Fixed handling of dynamic width in chrono formatter: @@ -60,12 +108,20 @@ Thanks `@Naios (Denis Blank) `_. +* Marked deprecated APIs with the ``[[deprecated]]`` attribute and removed + internal uses of deprecated APIs + (`#1022 `_). + Thanks `@eliaskosunen (Elias Kosunen) `_. + * Stopped setting ``CMAKE_BUILD_TYPE`` if fmt is a subproject (`#1081 `_). * Various fixes (`#980 `_, - `#995 `_ - `#998 `_). + `#995 `_, + `#998 `_, + `#1006 `_, + `#1008 `_, + `#1011 `_). Thanks `@DanielaE (Daniela Engert) `_, `@mwinterb `_.