diff --git a/ChangeLog.rst b/ChangeLog.rst index ce220cd4..449179cf 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -1,10 +1,23 @@ 7.1.0 - TBD ----------- +* Added a formatter for ``std::chrono::time_point``: + + .. code:: c++ + + #include + + int main() { + auto now = std::chrono::system_clock::now(); + fmt::print("The time is {:%H:%M:%S}.\n", now); + } + + Thanks `@adamburgess (Adam Burgess) `_. + * Added an experimental unsynchronized file output API which, together with - format string compilation, can give `5-9 times speed up compared to fprintf - `__ on - common platforms: + the format string compilation, can give `5-9 times speed up compared to + fprintf `_ + on common platforms: .. code:: c++ @@ -15,6 +28,33 @@ f.print("The answer is {}.", 42); } +* Added support for ranges with non-const ``begin``/``end`` to ``fmt::join`` + (`#1784 `_, + `#1786 `_) For example + (`godbolt `__): + + .. code:: c++ + + #include + #include + + int main() { + using std::literals::string_literals::operator""s; + auto strs = std::array{"a"s, "bb"s, "ccc"s}; + auto range = strs | ranges::views::filter( + [] (const std::string &x) { return x.size() != 2; } + ); + fmt::print("{}\n", fmt::join(range, "")); + } + + prints "accc". + + Thanks `@tonyelewis (Tony E Lewis) `_. + +* Added a ``memory_buffer::append`` overload that takes a range + (`#1806 `_). + Thanks `@BRevzin (Barry Revzin) `_. + * Improved handling of single code units in ``FMT_COMPILE``. For example: .. code:: c++ @@ -45,6 +85,9 @@ Here a single ``mov`` instruction writes ``'x'`` (``$120``) to the output buffer. +* Added dynamic width support to format string compilation + (`#1809 `_). + * Improved error reporting for unformattable types: now you'll get the type name directly in the error message instead of the note: @@ -66,9 +109,10 @@ https://fmt.dev/dev/api.html#udt" ... -* Added the [``make_args_checked``](https://fmt.dev/dev/api.html#argument-lists) +* Added the [``make_args_checked``](https://fmt.dev/7.1.0/api.html#argument-lists) function template that allows you to write formatting functions with - compile-time format string checks: + compile-time format string checks + (`godbolt `__): .. code:: c++ @@ -89,14 +133,58 @@ MY_LOG("invalid squishiness: {}", 42); +* Made ``format_to_n`` and ``formatted_size`` part of the `core API + `__ + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + char buf[10]; + auto end = fmt::format_to_n(buf, sizeof(buf), "{}", 42); + } + +* Made `#` emit trailing zeros. For example + (`godbolt `__): + + .. code:: c++ + + #include + + int main() { + fmt::print("{:#.2g}", 0.5); + } + + prints "0.50". + +* Made ``fmt::to_string`` fallback on ``ostream`` insertion operator if + the ``formatter`` specialization is not provided + (`#1815 `_, + `#1829 `_). + Thanks `@alexezeder (Alexey Ochapov) `_. + +* Added support for the append mode to the experimental file API + (`#1847 `_). + Thanks `@t-wiser `_. + * Fixed handling of types that have both an implicit conversion operator and an overloaded `ostream` insertion operator (`#1766 `_). +* Fixed a slicing issue in an internal iterator type + (`#1822 `_). + Thanks `@BRevzin (Barry Revzin) `_. + * Improved documentation (`#1772 `_, - `#1775 `_). - Thanks `@leolchat (Léonard Gérard) `_. + `#1775 `_, + `#1792 `_, + `#1838 `_). + Thanks `@leolchat (Léonard Gérard) `_, + `@pepsiman (Malcolm Parsons) `_, + `@Klaim (Joël Lamotte) `_. * Added the ``FMT_REDUCE_INT_INSTANTIATIONS`` CMake option that reduces the binary code size at the cost of some integer formatting performance. This can @@ -108,10 +196,35 @@ * Build configuration improvements (`#1760 `_, `#1770 `_, - `#1783 `_). + `#1779 `_, + `#1783 `_, + `#1823 `_). Thanks `@dvetutnev (Dmitriy Vetutnev) `_, `@xvitaly (Vitaly Zaitsev) `_, - `@tambry (Raul Tambre) `_. + `@tambry (Raul Tambre) `_, + `@medithe `_, + `@martinwuehrer (Martin Wührer) `_. + +* Fixed various warnings and compilation issues + (`#1790 `_, + `#1802 `_, + `#1808 `_, + `#1810 `_, + `#1811 `_, + `#1812 `_, + `#1814 `_, + `#1816 `_, + `#1817 `_, + `#1818 `_, + `#1825 `_, + `#1836 `_). + Thanks `@TheQwertiest `_, + `@medithe `_, + `@martinwuehrer (Martin Wührer) `_, + `@n16h7hunt3r `_, + `@Othereum (Seokjin Lee) `_, + `@gsjaardema (Greg Sjaardema) `_, + `@AlexanderLanin (Alexander Lanin) `_. 7.0.3 - 2020-08-06 ------------------ @@ -164,7 +277,7 @@ `_. * Added a simpler and more efficient `format string compilation API - `_: + `_: .. code:: c++ @@ -1820,7 +1933,7 @@ * Implemented ``constexpr`` parsing of format strings and `compile-time format string checks - `_. For + `_. For example .. code:: c++ @@ -1881,7 +1994,7 @@ throw format_error("invalid specifier"); * Added `iterator support - `_: + `_: .. code:: c++ @@ -1892,7 +2005,7 @@ fmt::format_to(std::back_inserter(out), "{}", 42); * Added the `format_to_n - `_ + `_ function that restricts the output to the specified number of characters (`#298 `_): @@ -1903,7 +2016,7 @@ // out == "1234" (without terminating '\0') * Added the `formatted_size - `_ + `_ function for computing the output size: .. code:: c++ @@ -1913,7 +2026,7 @@ auto size = fmt::formatted_size("{}", 12345); // size == 5 * Improved compile times by reducing dependencies on standard headers and - providing a lightweight `core API `_: + providing a lightweight `core API `_: .. code:: c++ @@ -1925,7 +2038,7 @@ `_. * Added the `make_format_args - `_ + `_ function for capturing formatting arguments: .. code:: c++ @@ -2007,7 +2120,7 @@ fmt::format("{} {two}", 1, fmt::arg("two", 2)); * Removed the write API in favor of the `format API - `_ with compile-time handling of + `_ with compile-time handling of format strings. * Disallowed formatting of multibyte strings into a wide character target