All Versions
37
Latest Version
Avg Release Cycle
64 days
Latest Release
106 days ago

Changelog History
Page 1

  • v8.0.1 Changes

    July 02, 2021
    • πŸ›  Fixed the version number in the inline namespace (#2374 <https://github.com/fmtlib/fmt/issues/2374>_).

    • βž• Added a missing presentation type check for std::string (#2402 <https://github.com/fmtlib/fmt/issues/2402>_).

    • πŸ›  Fixed a linkage error when mixing code built with clang and gcc (#2377 <https://github.com/fmtlib/fmt/issues/2377>_).

    • πŸ›  Fixed documentation issues (#2396 <https://github.com/fmtlib/fmt/pull/2396>, #2403 <https://github.com/fmtlib/fmt/issues/2403>, #2406 <https://github.com/fmtlib/fmt/issues/2406>). Thanks @mkurdej (Marek Kurdej) <https://github.com/mkurdej>.

    • βœ‚ Removed dead code in FP formatter ( #2398 <https://github.com/fmtlib/fmt/pull/2398>). Thanks @javierhonduco (Javier Honduvilla Coto) <https://github.com/javierhonduco>.

    • πŸ›  Fixed various warnings and compilation issues (#2351 <https://github.com/fmtlib/fmt/issues/2351>, #2359 <https://github.com/fmtlib/fmt/issues/2359>, #2365 <https://github.com/fmtlib/fmt/pull/2365>, #2368 <https://github.com/fmtlib/fmt/issues/2368>, #2370 <https://github.com/fmtlib/fmt/pull/2370>, #2376 <https://github.com/fmtlib/fmt/pull/2376>, #2381 <https://github.com/fmtlib/fmt/pull/2381>, #2382 <https://github.com/fmtlib/fmt/pull/2382>, #2386 <https://github.com/fmtlib/fmt/issues/2386>, #2389 <https://github.com/fmtlib/fmt/pull/2389>, #2395 <https://github.com/fmtlib/fmt/pull/2395>, #2397 <https://github.com/fmtlib/fmt/pull/2397>, #2400 <https://github.com/fmtlib/fmt/issues/2400>_ #2401 <https://github.com/fmtlib/fmt/issues/2401>, #2407 <https://github.com/fmtlib/fmt/pull/2407>). Thanks @zx2c4 (Jason A. Donenfeld) <https://github.com/zx2c4>, @AidanSun05 (Aidan Sun) <https://github.com/AidanSun05>, @mattiasljungstrom (Mattias LjungstrΓΆm) <https://github.com/mattiasljungstrom>, @joemmett (Jonathan Emmett) <https://github.com/joemmett>, @erengy (Eren Okka) <https://github.com/erengy>, @patlkli (Patrick Geltinger) <https://github.com/patlkli>, @gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>, @phprus (Vladislav Shchapov) <https://github.com/phprus>.

  • v8.0.0 Changes

    June 21, 2021
    • 0️⃣ Enabled compile-time format string check by default. For example (godbolt <https://godbolt.org/z/sMxcohGjz>__):

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("{:d}", "I am not a number");
     }
    

    gives a compile-time error on compilers with C++20 consteval support (gcc 10+, clang 11+) because d is not a valid format specifier for a string.

    To pass a runtime string wrap it in fmt::runtime:

    .. code:: c++

     fmt::print(fmt::runtime("{:d}"), "I am not a number");
    
    • βž• Added compile-time formatting (#2019 <https://github.com/fmtlib/fmt/pull/2019>, #2044 <https://github.com/fmtlib/fmt/pull/2044>, #2056 <https://github.com/fmtlib/fmt/pull/2056>, #2072 <https://github.com/fmtlib/fmt/pull/2072>, #2075 <https://github.com/fmtlib/fmt/pull/2075>, #2078 <https://github.com/fmtlib/fmt/issues/2078>, #2129 <https://github.com/fmtlib/fmt/pull/2129>, #2326 <https://github.com/fmtlib/fmt/pull/2326>). For example (godbolt <https://godbolt.org/z/Mxx9d89jM>__):

    .. code:: c++

     #include <fmt/compile.h>
    
     consteval auto compile_time_itoa(int value) -> std::array<char, 10> {
       auto result = std::array<char, 10>();
       fmt::format_to(result.data(), FMT_COMPILE("{}"), value);
       return result;
     }
    
     constexpr auto answer = compile_time_itoa(42);
    

    Most of the formatting functionality is available at compile time with a notable exception of floating-point numbers and pointers. Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • ⚑️ Optimized handling of format specifiers during format string compilation. For example, hexadecimal formatting ("{:x}") is now 3-7x faster than before when using format_to with format string compilation and a stack-allocated buffer (#1944 <https://github.com/fmtlib/fmt/issues/1944>_).

    Before (7.1.3)::

    ----------------------------------------------------------------------------
    Benchmark                                  Time             CPU   Iterations
    ----------------------------------------------------------------------------
    FMTCompileOld/0                         15.5 ns         15.5 ns     43302898
    FMTCompileOld/42                        16.6 ns         16.6 ns     43278267
    FMTCompileOld/273123                    18.7 ns         18.6 ns     37035861
    FMTCompileOld/9223372036854775807       19.4 ns         19.4 ns     35243000
    ----------------------------------------------------------------------------
    

    After (8.x)::

    ----------------------------------------------------------------------------
    Benchmark                                  Time             CPU   Iterations
    ----------------------------------------------------------------------------
    FMTCompileNew/0                         1.99 ns         1.99 ns    360523686
    FMTCompileNew/42                        2.33 ns         2.33 ns    279865664
    FMTCompileNew/273123                    3.72 ns         3.71 ns    190230315
    FMTCompileNew/9223372036854775807       5.28 ns         5.26 ns    130711631
    ----------------------------------------------------------------------------
    

    It is even faster than std::to_chars from libc++ compiled with clang on macOS::

    ----------------------------------------------------------------------------
    Benchmark                                  Time             CPU   Iterations
    ----------------------------------------------------------------------------
    ToChars/0                               4.42 ns         4.41 ns    160196630
    ToChars/42                              5.00 ns         4.98 ns    140735201
    ToChars/273123                          7.26 ns         7.24 ns     95784130
    ToChars/9223372036854775807             8.77 ns         8.75 ns     75872534
    ----------------------------------------------------------------------------
    

    In other cases, especially involving std::string construction, the speed up is usually lower because handling format specifiers takes a smaller fraction of the total time.

    • βž• Added the _cf user-defined literal to represent a compiled format string. It can be used instead of the FMT_COMPILE macro (#2043 <https://github.com/fmtlib/fmt/pull/2043>, #2242 <https://github.com/fmtlib/fmt/pull/2242>):

    .. code:: c++

     #include <fmt/compile.h>
    
     using namespace fmt::literals;
     auto s = fmt::format(FMT_COMPILE("{}"), 42); // πŸ™ not modern
     auto s = fmt::format("{}"_cf, 42);           // πŸ™‚ modern as hell
    

    It requires compiler support for class types in non-type template parameters (a C++20 feature) which is available in GCC 9.3+. Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • Format string compilation now requires format functions of formatter specializations for user-defined types to be const:

    .. code:: c++

     template <> struct fmt::formatter<my_type>: formatter<string_view> {
       template <typename FormatContext>
       auto format(my_type obj, FormatContext& ctx) const {  // Note const here.
         // ...
       }
     };
    
    • βž• Added UDL-based named argument support to format string compilation (#2243 <https://github.com/fmtlib/fmt/pull/2243>, #2281 <https://github.com/fmtlib/fmt/pull/2281>). For example:

    .. code:: c++

     #include <fmt/compile.h>
    
     using namespace fmt::literals;
     auto s = fmt::format(FMT_COMPILE("{answer}"), "answer"_a = 42);
    

    Here the argument named "answer" is resolved at compile time with no runtime overhead. Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • βž• Added format string compilation support to fmt::print (#2280 <https://github.com/fmtlib/fmt/issues/2280>, #2304 <https://github.com/fmtlib/fmt/pull/2304>). Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • βž• Added initial support for compiling {fmt} as a C++20 module (#2235 <https://github.com/fmtlib/fmt/pull/2235>, #2240 <https://github.com/fmtlib/fmt/pull/2240>, #2260 <https://github.com/fmtlib/fmt/pull/2260>, #2282 <https://github.com/fmtlib/fmt/pull/2282>, #2283 <https://github.com/fmtlib/fmt/pull/2283>, #2288 <https://github.com/fmtlib/fmt/pull/2288>, #2298 <https://github.com/fmtlib/fmt/pull/2298>, #2306 <https://github.com/fmtlib/fmt/pull/2306>, #2307 <https://github.com/fmtlib/fmt/pull/2307>, #2309 <https://github.com/fmtlib/fmt/pull/2309>, #2318 <https://github.com/fmtlib/fmt/pull/2318>, #2324 <https://github.com/fmtlib/fmt/pull/2324>, #2332 <https://github.com/fmtlib/fmt/pull/2332>, #2340 <https://github.com/fmtlib/fmt/pull/2340>). Thanks @DanielaE (Daniela Engert) <https://github.com/DanielaE>_.

    • 0️⃣ Made symbols private by default reducing shared library size (#2301 <https://github.com/fmtlib/fmt/pull/2301>). For example there was a ~15% reported reduction on one platform. Thanks @sergiud (Sergiu Deitsch) <https://github.com/sergiud>.

    • ⚑️ Optimized includes making the result of preprocessing fmt/format.h ~20% smaller with libstdc++/C++20 and slightly improving build times (#1998 <https://github.com/fmtlib/fmt/issues/1998>_).

    • βž• Added support of ranges with non-const begin / end (#1953 <https://github.com/fmtlib/fmt/pull/1953>). Thanks @kitegi (sarah) <https://github.com/kitegi>.

    • βž• Added support of std::byte and other formattable types to fmt::join (#1981 <https://github.com/fmtlib/fmt/issues/1981>, #2040 <https://github.com/fmtlib/fmt/issues/2040>, #2050 <https://github.com/fmtlib/fmt/pull/2050>, #2262 <https://github.com/fmtlib/fmt/issues/2262>). For example:

    .. code:: c++

     #include <fmt/format.h>
     #include <cstddef>
     #include <vector>
    
     int main() {
       auto bytes = std::vector{std::byte(4), std::byte(2)};
       fmt::print("{}", fmt::join(bytes, ""));
     }
    

    prints "42".

    Thanks @kamibo (Camille Bordignon) <https://github.com/kamibo>_.

    • 0️⃣ Implemented the default format for std::chrono::system_clock (#2319 <https://github.com/fmtlib/fmt/issues/2319>, #2345 <https://github.com/fmtlib/fmt/pull/2345>). For example:

    .. code:: c++

     #include <fmt/chrono.h>
    
     int main() {
       fmt::print("{}", std::chrono::system_clock::now());
     }
    

    prints "2021-06-18 15:22:00" (the output depends on the current date and time). Thanks @sunmy2019 <https://github.com/sunmy2019>_.

    • 0️⃣ Made more chrono specifiers locale independent by default. Use the 'L' specifier to get localized formatting. For example:

    .. code:: c++

     #include <fmt/chrono.h>
    
     int main() {
       std::locale::global(std::locale("ru_RU.UTF-8"));
       auto monday = std::chrono::weekday(1);
       fmt::print("{}\n", monday);   // prints "Mon"
       fmt::print("{:L}\n", monday); // prints "ΠΏΠ½"
     }
    
    • πŸ‘Œ Improved locale handling in chrono formatting (#2337 <https://github.com/fmtlib/fmt/issues/2337>, #2349 <https://github.com/fmtlib/fmt/pull/2349>, #2350 <https://github.com/fmtlib/fmt/pull/2350>). Thanks @phprus (Vladislav Shchapov) <https://github.com/phprus>.

    • πŸ—„ Deprecated fmt/locale.h moving the formatting functions that take a locale to fmt/format.h (char) and fmt/xchar (other overloads). This doesn't introduce a dependency on <locale> so there is virtually no compile time effect.

    • Made parameter order in vformat_to consistent with format_to (#2327 <https://github.com/fmtlib/fmt/issues/2327>_).

    • βž• Added support for time points with arbitrary durations (#2208 <https://github.com/fmtlib/fmt/issues/2208>_). For example:

    .. code:: c++

     #include <fmt/chrono.h>
    
     int main() {
       using tp = std::chrono::time_point<
         std::chrono::system_clock, std::chrono::seconds>;
       fmt::print("{:%S}", tp(std::chrono::seconds(42)));
     }
    

    prints "42".

    • 0️⃣ Formatting floating-point numbers no longer produces trailing zeros by default for consistency with std::format. For example:

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("{0:.3}", 1.1);
     }
    

    prints "1.1". Use the '#' specifier to keep trailing zeros.

    • ⬇️ Dropped a limit on the number of elements in a range and replaced {} with [] as range delimiters for consistency with Python's str.format.

    • The 'L' specifier for locale-specific numeric formatting can now be combined with presentation specifiers as in std::format. For example:

    .. code:: c++

     #include <fmt/core.h>
     #include <locale>
    
     int main() {
       std::locale::global(std::locale("fr_FR.UTF-8"));
       fmt::print("{0:.2Lf}", 0.42);
     }
    

    prints "0,42". The deprecated 'n' specifier has been removed.

    • Made the 0 specifier ignored for infinity and NaN (#2305 <https://github.com/fmtlib/fmt/issues/2305>, #2310 <https://github.com/fmtlib/fmt/pull/2310>). Thanks @Liedtke (Matthias Liedtke) <https://github.com/Liedtke>_.

    • 0️⃣ Made the hexfloat formatting use the right alignment by default (#2308 <https://github.com/fmtlib/fmt/issues/2308>, #2317 <https://github.com/fmtlib/fmt/pull/2317>). Thanks @Liedtke (Matthias Liedtke) <https://github.com/Liedtke>_.

    • βœ‚ Removed the deprecated numeric alignment ('='). Use the '0' specifier instead.

    • βœ‚ Removed the deprecated fmt/posix.h header that has been replaced with fmt/os.h.

    • Removed the deprecated format_to_n_context, format_to_n_args and make_format_to_n_args. They have been replaced with format_context, format_args` andmake_format_args`` respectively.

    • 🚚 Moved wchar_t-specific functions and types to fmt/xchar.h. You can define FMT_DEPRECATED_INCLUDE_XCHAR to automatically include fmt/xchar.h from fmt/format.h but this will be disabled in the next major release.

    • πŸ›  Fixed handling of the '+' specifier in localized formatting (#2133 <https://github.com/fmtlib/fmt/issues/2133>_).

    • βž• Added support for the 's' format specifier that gives textual representation of bool (#2094 <https://github.com/fmtlib/fmt/issues/2094>, #2109 <https://github.com/fmtlib/fmt/pull/2109>). For example:

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("{:s}", true);
     }
    

    prints "true". Thanks @powercoderlol (Ivan Polyakov) <https://github.com/powercoderlol>_.

    • Made fmt::ptr work with function pointers (#2131 <https://github.com/fmtlib/fmt/pull/2131>_). For example:

    .. code:: c++

     #include <fmt/format.h>
    
     int main() {
       fmt::print("My main: {}\n", fmt::ptr(main));
     }
    

    Thanks @mikecrowe (Mike Crowe) <https://github.com/mikecrowe>_.

    • πŸ‘ The undocumented support for specializing formatter for pointer types has been removed.

    • πŸ›  Fixed fmt::formatted_size with format string compilation (#2141 <https://github.com/fmtlib/fmt/pull/2141>, #2161 <https://github.com/fmtlib/fmt/pull/2161>). Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • πŸ›  Fixed handling of empty format strings during format string compilation (#2042 <https://github.com/fmtlib/fmt/issues/2042>_):

    .. code:: c++

     auto s = fmt::format(FMT_COMPILE(""));
    

    Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • πŸ›  Fixed handling of enums in fmt::to_string (#2036 <https://github.com/fmtlib/fmt/issues/2036>_).

    • πŸ‘Œ Improved width computation (#2033 <https://github.com/fmtlib/fmt/issues/2033>, #2091 <https://github.com/fmtlib/fmt/issues/2091>). For example:

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("{:-<10}{}\n", "δ½ ε₯½", "δΈ–η•Œ");
       fmt::print("{:-<10}{}\n", "hello", "world");
     }
    

    prints

    .. image:: https://user-images.githubusercontent.com/576385/ 119840373-cea3ca80-beb9-11eb-91e0-54266c48e181.png

    on a modern terminal.

    • The experimental fast output stream (fmt::ostream) is now truncated by default for consistency with fopen (#2018 <https://github.com/fmtlib/fmt/issues/2018>_). For example:

    .. code:: c++

     #include <fmt/os.h>
    
     int main() {
       fmt::ostream out1 = fmt::output_file("guide");
       out1.print("Zaphod");
       out1.close();
       fmt::ostream out2 = fmt::output_file("guide");
       out2.print("Ford");
     }
    

    writes "Ford" to the file "guide". To preserve the old file content if any pass fmt::file::WRONLY | fmt::file::CREATE flags to fmt::output_file.

    • πŸ›  Fixed moving of fmt::ostream that holds buffered data (#2197 <https://github.com/fmtlib/fmt/issues/2197>, #2198 <https://github.com/fmtlib/fmt/pull/2198>). Thanks @vtta <https://github.com/vtta>_.

    • πŸ‘» Replaced the fmt::system_error exception with a function of the same name that constructs std::system_error (#2266 <https://github.com/fmtlib/fmt/issues/2266>_).

    • 🏁 Replaced the fmt::windows_error exception with a function of the same name that constructs std::system_error with the category returned by fmt::system_category() (#2274 <https://github.com/fmtlib/fmt/issues/2274>, #2275 <https://github.com/fmtlib/fmt/pull/2275>). The latter is similar to std::sytem_category but correctly handles UTF-8. Thanks @phprus (Vladislav Shchapov) <https://github.com/phprus>_.

    • Replaced fmt::error_code with std::error_code and made it formattable (#2269 <https://github.com/fmtlib/fmt/issues/2269>, #2270 <https://github.com/fmtlib/fmt/pull/2270>, #2273 <https://github.com/fmtlib/fmt/pull/2273>). Thanks @phprus (Vladislav Shchapov) <https://github.com/phprus>.

    • βž• Added speech synthesis support (#2206 <https://github.com/fmtlib/fmt/pull/2206>_).

    • Made format_to work with a memory buffer that has a custom allocator (#2300 <https://github.com/fmtlib/fmt/pull/2300>). Thanks @voxmea <https://github.com/voxmea>.

    • πŸ‘ Added Allocator::max_size support to basic_memory_buffer. (#1960 <https://github.com/fmtlib/fmt/pull/1960>). Thanks @phprus (Vladislav Shchapov) <https://github.com/phprus>.

    • βž• Added wide string support to fmt::join (#2236 <https://github.com/fmtlib/fmt/pull/2236>). Thanks @crbrz <https://github.com/crbrz>.

    • Made iterators passed to formatter specializations via a format context satisfy C++20 std::output_iterator requirements (#2156 <https://github.com/fmtlib/fmt/issues/2156>, #2158 <https://github.com/fmtlib/fmt/pull/2158>, #2195 <https://github.com/fmtlib/fmt/issues/2195>, #2204 <https://github.com/fmtlib/fmt/pull/2204>). Thanks @randomnetcat (Jason Cobb) <https://github.com/randomnetcat>_.

    • ⚑️ Optimized the printf implementation (#1982 <https://github.com/fmtlib/fmt/pull/1982>, #1984 <https://github.com/fmtlib/fmt/pull/1984>, #2016 <https://github.com/fmtlib/fmt/pull/2016>, #2164 <https://github.com/fmtlib/fmt/pull/2164>). Thanks @rimathia <https://github.com/rimathia>_ and @moiwi <https://github.com/moiwi>_.

    • πŸ‘Œ Improved detection of constexpr char_traits (#2246 <https://github.com/fmtlib/fmt/pull/2246>, #2257 <https://github.com/fmtlib/fmt/pull/2257>). Thanks @phprus (Vladislav Shchapov) <https://github.com/phprus>_.

    • πŸ›  Fixed writing to stdout when it is redirected to NUL on Windows (#2080 <https://github.com/fmtlib/fmt/issues/2080>_).

    • πŸ›  Fixed exception propagation from iterators (#2097 <https://github.com/fmtlib/fmt/issues/2097>_).

    • πŸ‘Œ Improved strftime error handling (#2238 <https://github.com/fmtlib/fmt/issues/2238>, #2244 <https://github.com/fmtlib/fmt/pull/2244>). Thanks @yumeyao <https://github.com/yumeyao>_.

    • πŸ—„ Stopped using deprecated GCC UDL template extension.

    • βž• Added fmt/args.h to the install target (#2096 <https://github.com/fmtlib/fmt/issues/2096>_).

    • Error messages are now passed to assert when exceptions are disabled (#2145 <https://github.com/fmtlib/fmt/pull/2145>). Thanks @NobodyXu (Jiahao XU) <https://github.com/NobodyXu>.

    • Added the FMT_MASTER_PROJECT CMake option to control build and install targets when {fmt} is included via add_subdirectory (#2098 <https://github.com/fmtlib/fmt/issues/2098>, #2100 <https://github.com/fmtlib/fmt/pull/2100>). Thanks @randomizedthinking <https://github.com/randomizedthinking>_.

    • πŸ‘Œ Improved build configuration (#2026 <https://github.com/fmtlib/fmt/pull/2026>, #2122 <https://github.com/fmtlib/fmt/pull/2122>). Thanks @luncliff (Park DongHa) <https://github.com/luncliff>_ and @ibaned (Dan Ibanez) <https://github.com/ibaned>_.

    • πŸ›  Fixed various warnings and compilation issues (#1947 <https://github.com/fmtlib/fmt/issues/1947>, #1959 <https://github.com/fmtlib/fmt/pull/1959>, #1963 <https://github.com/fmtlib/fmt/pull/1963>, #1965 <https://github.com/fmtlib/fmt/pull/1965>, #1966 <https://github.com/fmtlib/fmt/issues/1966>, #1974 <https://github.com/fmtlib/fmt/pull/1974>, #1975 <https://github.com/fmtlib/fmt/pull/1975>, #1990 <https://github.com/fmtlib/fmt/pull/1990>, #2000 <https://github.com/fmtlib/fmt/issues/2000>, #2001 <https://github.com/fmtlib/fmt/pull/2001>, #2002 <https://github.com/fmtlib/fmt/issues/2002>, #2004 <https://github.com/fmtlib/fmt/issues/2004>, #2006 <https://github.com/fmtlib/fmt/pull/2006>, #2009 <https://github.com/fmtlib/fmt/pull/2009>, #2010 <https://github.com/fmtlib/fmt/pull/2010>, #2038 <https://github.com/fmtlib/fmt/issues/2038>, #2039 <https://github.com/fmtlib/fmt/issues/2039>, #2047 <https://github.com/fmtlib/fmt/issues/2047>, #2053 <https://github.com/fmtlib/fmt/pull/2053>, #2059 <https://github.com/fmtlib/fmt/issues/2059>, #2065 <https://github.com/fmtlib/fmt/pull/2065>, #2067 <https://github.com/fmtlib/fmt/pull/2067>, #2068 <https://github.com/fmtlib/fmt/pull/2068>, #2073 <https://github.com/fmtlib/fmt/pull/2073>, #2103 <https://github.com/fmtlib/fmt/issues/2103>_ #2105 <https://github.com/fmtlib/fmt/issues/2105>_ #2106 <https://github.com/fmtlib/fmt/pull/2106>, #2107 <https://github.com/fmtlib/fmt/pull/2107>, #2116 <https://github.com/fmtlib/fmt/issues/2116>_ #2117 <https://github.com/fmtlib/fmt/pull/2117>, #2118 <https://github.com/fmtlib/fmt/issues/2118> #2119 <https://github.com/fmtlib/fmt/pull/2119>, #2127 <https://github.com/fmtlib/fmt/issues/2127>, #2128 <https://github.com/fmtlib/fmt/pull/2128>, #2140 <https://github.com/fmtlib/fmt/issues/2140>, #2142 <https://github.com/fmtlib/fmt/issues/2142>, #2143 <https://github.com/fmtlib/fmt/pull/2143>, #2144 <https://github.com/fmtlib/fmt/pull/2144>, #2147 <https://github.com/fmtlib/fmt/issues/2147>, #2148 <https://github.com/fmtlib/fmt/issues/2148>, #2149 <https://github.com/fmtlib/fmt/issues/2149>, #2152 <https://github.com/fmtlib/fmt/pull/2152>, #2160 <https://github.com/fmtlib/fmt/pull/2160>, #2170 <https://github.com/fmtlib/fmt/issues/2170>, #2175 <https://github.com/fmtlib/fmt/issues/2175>, #2176 <https://github.com/fmtlib/fmt/issues/2176>, #2177 <https://github.com/fmtlib/fmt/pull/2177>, #2178 <https://github.com/fmtlib/fmt/issues/2178>, #2179 <https://github.com/fmtlib/fmt/pull/2179>, #2180 <https://github.com/fmtlib/fmt/issues/2180>, #2181 <https://github.com/fmtlib/fmt/issues/2181>, #2183 <https://github.com/fmtlib/fmt/pull/2183>, #2184 <https://github.com/fmtlib/fmt/issues/2184>, #2185 <https://github.com/fmtlib/fmt/issues/2185>, #2186 <https://github.com/fmtlib/fmt/pull/2186>, #2187 <https://github.com/fmtlib/fmt/pull/2187>, #2190 <https://github.com/fmtlib/fmt/pull/2190>, #2192 <https://github.com/fmtlib/fmt/pull/2192>, #2194 <https://github.com/fmtlib/fmt/pull/2194>, #2205 <https://github.com/fmtlib/fmt/pull/2205>, #2210 <https://github.com/fmtlib/fmt/issues/2210>, #2211 <https://github.com/fmtlib/fmt/pull/2211>, #2215 <https://github.com/fmtlib/fmt/pull/2215>, #2216 <https://github.com/fmtlib/fmt/pull/2216>, #2218 <https://github.com/fmtlib/fmt/pull/2218>, #2220 <https://github.com/fmtlib/fmt/pull/2220>, #2228 <https://github.com/fmtlib/fmt/issues/2228>, #2229 <https://github.com/fmtlib/fmt/pull/2229>, #2230 <https://github.com/fmtlib/fmt/pull/2230>, #2233 <https://github.com/fmtlib/fmt/issues/2233>, #2239 <https://github.com/fmtlib/fmt/pull/2239>, #2248 <https://github.com/fmtlib/fmt/issues/2248>, #2252 <https://github.com/fmtlib/fmt/issues/2252>, #2253 <https://github.com/fmtlib/fmt/pull/2253>, #2255 <https://github.com/fmtlib/fmt/pull/2255>, #2261 <https://github.com/fmtlib/fmt/issues/2261>, #2278 <https://github.com/fmtlib/fmt/issues/2278>, #2284 <https://github.com/fmtlib/fmt/issues/2284>, #2287 <https://github.com/fmtlib/fmt/pull/2287>, #2289 <https://github.com/fmtlib/fmt/pull/2289>, #2290 <https://github.com/fmtlib/fmt/pull/2290>, #2293 <https://github.com/fmtlib/fmt/pull/2293>, #2295 <https://github.com/fmtlib/fmt/issues/2295>, #2296 <https://github.com/fmtlib/fmt/pull/2296>, #2297 <https://github.com/fmtlib/fmt/pull/2297>, #2311 <https://github.com/fmtlib/fmt/issues/2311>, #2313 <https://github.com/fmtlib/fmt/pull/2313>, #2315 <https://github.com/fmtlib/fmt/pull/2315>, #2320 <https://github.com/fmtlib/fmt/issues/2320>, #2321 <https://github.com/fmtlib/fmt/pull/2321>, #2323 <https://github.com/fmtlib/fmt/pull/2323>, #2328 <https://github.com/fmtlib/fmt/issues/2328>, #2329 <https://github.com/fmtlib/fmt/pull/2329>, #2333 <https://github.com/fmtlib/fmt/pull/2333>, #2338 <https://github.com/fmtlib/fmt/pull/2338>, #2341 <https://github.com/fmtlib/fmt/pull/2341>). Thanks @darklukee <https://github.com/darklukee>, @fagg (Ashton Fagg) <https://github.com/fagg>, @killerbot242 (Lieven de Cock) <https://github.com/killerbot242>, @jgopel (Jonathan Gopel) <https://github.com/jgopel>, @yeswalrus (Walter Gray) <https://github.com/yeswalrus>, @Finkman <https://github.com/Finkman>, @HazardyKnusperkeks (BjΓΆrn SchΓ€pers) <https://github.com/HazardyKnusperkeks>, @dkavolis (Daumantas Kavolis) <https://github.com/dkavolis>_ @concatime (Issam Maghni) <https://github.com/concatime>, @chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>, @summivox (Yin Zhong) <https://github.com/summivox>, @yNeo <https://github.com/yNeo>, @Apache-HB (Elliot) <https://github.com/Apache-HB>, @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>, @toojays (John Steele Scott) <https://github.com/toojays>, @Brainy0207 <https://github.com/Brainy0207>, @vadz (VZ) <https://github.com/vadz>, @imsherlock (Ryan Sherlock) <https://github.com/imsherlock>, @phprus (Vladislav Shchapov) <https://github.com/phprus>, @white238 (Chris White) <https://github.com/white238>, @yafshar (Yaser Afshar) <https://github.com/yafshar>, @BillyDonahue (Billy Donahue) <https://github.com/BillyDonahue>, @jstaahl <https://github.com/jstaahl>, @denchat <https://github.com/denchat>, @DanielaE (Daniela Engert) <https://github.com/DanielaE>, @ilyakurdyukov (Ilya Kurdyukov) <https://github.com/ilyakurdyukov>, @ilmai <https://github.com/ilmai>, @JessyDL (Jessy De Lannoit) <https://github.com/JessyDL>, @sergiud (Sergiu Deitsch) <https://github.com/sergiud>, @mwinterb <https://github.com/mwinterb>, @sven-herrmann <https://github.com/sven-herrmann>, @jmelas (John Melas) <https://github.com/jmelas>, @twoixter (Jose Miguel PΓ©rez) <https://github.com/twoixter>, @crbrz <https://github.com/crbrz>, @upsj (Tobias Ribizel) <https://github.com/upsj>_.

    • πŸ‘Œ Improved documentation (#1986 <https://github.com/fmtlib/fmt/issues/1986>, #2051 <https://github.com/fmtlib/fmt/pull/2051>, #2057 <https://github.com/fmtlib/fmt/issues/2057>, #2081 <https://github.com/fmtlib/fmt/pull/2081>, #2084 <https://github.com/fmtlib/fmt/issues/2084>, #2312 <https://github.com/fmtlib/fmt/pull/2312>). Thanks @imba-tjd (谭九鼎) <https://github.com/imba-tjd>, @0x416c69 (AlΞΉAΡ•Ρ•aΡ•Ρ•ΞΉN) <https://github.com/0x416c69>, @mordante <https://github.com/mordante>_.

    • βœ… Continuous integration and test improvements (#1969 <https://github.com/fmtlib/fmt/issues/1969>, #1991 <https://github.com/fmtlib/fmt/pull/1991>, #2020 <https://github.com/fmtlib/fmt/pull/2020>, #2110 <https://github.com/fmtlib/fmt/pull/2110>, #2114 <https://github.com/fmtlib/fmt/pull/2114>, #2196 <https://github.com/fmtlib/fmt/issues/2196>, #2217 <https://github.com/fmtlib/fmt/pull/2217>, #2247 <https://github.com/fmtlib/fmt/pull/2247>, #2256 <https://github.com/fmtlib/fmt/pull/2256>, #2336 <https://github.com/fmtlib/fmt/pull/2336>, #2346 <https://github.com/fmtlib/fmt/pull/2346>). Thanks @jgopel (Jonathan Gopel) <https://github.com/jgopel>, @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_ and @DanielaE (Daniela Engert) <https://github.com/DanielaE>_.

  • v7.1.3 Changes

    November 25, 2020
    • Fixed handling of buffer boundaries in format_to_n (#1996 <https://github.com/fmtlib/fmt/issues/1996>, #2029 <https://github.com/fmtlib/fmt/issues/2029>).

    • πŸ›  Fixed linkage errors when linking with a shared library (#2011 <https://github.com/fmtlib/fmt/issues/2011>_).

    • πŸ‘ Reintroduced ostream support to range formatters (#2014 <https://github.com/fmtlib/fmt/issues/2014>_).

    • Worked around an issue with mixing std versions in gcc (#2017 <https://github.com/fmtlib/fmt/issues/2017>_).

  • v7.1.2 Changes

    November 04, 2020
    • πŸ›  Fixed floating point formatting with large precision (#1976 <https://github.com/fmtlib/fmt/issues/1976>_).
  • v7.1.1 Changes

    November 02, 2020
    • πŸ›  Fixed ABI compatibility with 7.0.x (#1961 <https://github.com/fmtlib/fmt/issues/1961>_).

    • Added the FMT_ARM_ABI_COMPATIBILITY macro to work around ABI incompatibility between GCC and Clang on ARM (#1919 <https://github.com/fmtlib/fmt/issues/1919>_).

    • Worked around a SFINAE bug in GCC 8 (#1957 <https://github.com/fmtlib/fmt/issues/1957>_).

    • πŸ›  Fixed linkage errors when building with GCC's LTO (#1955 <https://github.com/fmtlib/fmt/issues/1955>_).

    • Fixed a compilation error when building without __builtin_clz or equivalent (#1968 <https://github.com/fmtlib/fmt/pull/1968>). Thanks @tohammer (Tobias Hammer) <https://github.com/tohammer>.

    • πŸ›  Fixed a sign conversion warning (#1964 <https://github.com/fmtlib/fmt/pull/1964>). Thanks @OptoCloud <https://github.com/OptoCloud>.

  • v7.1.0 Changes

    October 26, 2020
    • Switched from Grisu3 <https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf>_ to Dragonbox <https://github.com/jk-jeon/dragonbox>_ for the default floating-point formatting which gives the shortest decimal representation with round-trip guarantee and correct rounding (#1882 <https://github.com/fmtlib/fmt/pull/1882>, #1887 <https://github.com/fmtlib/fmt/pull/1887>, #1894 <https://github.com/fmtlib/fmt/pull/1894>). This makes {fmt} up to 20-30x faster than common implementations of std::ostringstream and sprintf on dtoa-benchmark <https://github.com/fmtlib/dtoa-benchmark> and faster than double-conversion and RyΕ«:

    .. image:: https://user-images.githubusercontent.com/576385/ 95684665-11719600-0ba8-11eb-8e5b-972ff4e49428.png

    It is possible to get even better performance at the cost of larger binary size by compiling with the FMT_USE_FULL_CACHE_DRAGONBOX macro set to 1.

    Thanks @jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>_.

    • βž• Added an experimental unsynchronized file output API which, together with format string compilation <https://fmt.dev/latest/api.html#compile-api>, can give 5-9 times speed up compared to fprintf <https://www.zverovich.net/2020/08/04/optimal-file-buffer-size.html> on common platforms (godbolt <https://godbolt.org/z/nsTcG8>__):

    .. code:: c++

     #include <fmt/os.h>
    
     int main() {
       auto f = fmt::output_file("guide");
       f.print("The answer is {}.", 42);
     }
    
    • Added a formatter for std::chrono::time_point<system_clock> (#1819 <https://github.com/fmtlib/fmt/issues/1819>, #1837 <https://github.com/fmtlib/fmt/pull/1837>). For example (godbolt <https://godbolt.org/z/c4M6fh>__):

    .. code:: c++

     #include <fmt/chrono.h>
    
     int main() {
       auto now = std::chrono::system_clock::now();
       fmt::print("The time is {:%H:%M:%S}.\n", now);
     }
    

    Thanks @adamburgess (Adam Burgess) <https://github.com/adamburgess>_.

    • βž• Added support for ranges with non-const begin/end to fmt::join (#1784 <https://github.com/fmtlib/fmt/issues/1784>, #1786 <https://github.com/fmtlib/fmt/pull/1786>). For example (godbolt <https://godbolt.org/z/jP63Tv>__):

    .. code:: c++

     #include <fmt/ranges.h>
     #include <range/v3/view/filter.hpp>
    
     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) <https://github.com/tonyelewis>_.

    • βž• Added a memory_buffer::append overload that takes a range (#1806 <https://github.com/fmtlib/fmt/pull/1806>). Thanks @BRevzin (Barry Revzin) <https://github.com/BRevzin>.

    • πŸ‘Œ Improved handling of single code units in FMT_COMPILE. For example:

    .. code:: c++

     #include <fmt/compile.h>
    
     char* f(char* buf) {
       return fmt::format_to(buf, FMT_COMPILE("x{}"), 42);
     }
    

    compiles to just (godbolt <https://godbolt.org/z/5vncz3>__):

    .. code:: asm

     _Z1fPc:
       movb $120, (%rdi)
       xorl %edx, %edx
       cmpl $42, _ZN3fmt2v76detail10basic_dataIvE23zero_or_powers_of_10_32E+8(%rip)
       movl $3, %eax
       seta %dl
       subl %edx, %eax
       movzwl _ZN3fmt2v76detail10basic_dataIvE6digitsE+84(%rip), %edx
       cltq
       addq %rdi, %rax
       movw %dx, -2(%rax)
       ret
    

    Here a single mov instruction writes 'x' ($120) to the output buffer.

    • βž• Added dynamic width support to format string compilation (#1809 <https://github.com/fmtlib/fmt/issues/1809>_).

    • πŸ‘Œ Improved error reporting for unformattable types: now you'll get the type name directly in the error message instead of the note:

    .. code:: c++

     #include <fmt/core.h>
    
     struct how_about_no {};
    
     int main() {
       fmt::print("{}", how_about_no());
     }
    

    Error (godbolt <https://godbolt.org/z/GoxM4e>__):

    fmt/core.h:1438:3: error: static_assert failed due to requirement 'fmt::v7::formattable<how_about_no>()' "Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt" ...

    • 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 and avoid binary code bloat (godbolt <https://godbolt.org/z/PEf9qr>__):

    .. code:: c++

     void vlog(const char* file, int line, fmt::string_view format,
               fmt::format_args args) {
       fmt::print("{}: {}: ", file, line);
       fmt::vprint(format, args);
     }
    
     template <typename S, typename... Args>
     void log(const char* file, int line, const S& format, Args&&... args) {
       vlog(file, line, format,
           fmt::make_args_checked<Args...>(format, args...));
     }
    
     #define MY_LOG(format, ...) \
       log(__FILE__, __LINE__, FMT_STRING(format), __VA_ARGS__)
    
     MY_LOG("invalid squishiness: {}", 42);
    
    • πŸ–¨ Replaced snprintf fallback with a faster internal IEEE 754 float and double formatter for arbitrary precision. For example (godbolt <https://godbolt.org/z/dPhWvj>__):

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("{:.500}\n", 4.9406564584124654E-324);
     }
    

    prints

    4.9406564584124654417656879286822137236505980261432476442558568250067550727020875186529983636163599237979656469544571773092665671035593979639877479601078187812630071319031140452784581716784898210368871863605699873072305000638740915356498438731247339727316961514003171538539807412623856559117102665855668676818703956031062493194527159149245532930545654440112748012970999954193198940908041656332452475714786901472678015935523861155013480352649347201937902681071074917033322268447533357208324319360923829e-324.

    • Made format_to_n and formatted_size part of the core API <https://fmt.dev/latest/api.html#core-api>__ (godbolt <https://godbolt.org/z/sPjY1K>__):

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       char buffer[10];
       auto result = fmt::format_to_n(buffer, sizeof(buffer), "{}", 42);
     }
    
    • Added fmt::format_to_n overload with format string compilation (#1764 <https://github.com/fmtlib/fmt/issues/1764>, #1767 <https://github.com/fmtlib/fmt/pull/1767>, #1869 <https://github.com/fmtlib/fmt/pull/1869>). For example (godbolt <https://godbolt.org/z/93h86q>_):

    .. code:: c++

     #include <fmt/compile.h>
    
     int main() {
       char buffer[8];
       fmt::format_to_n(buffer, sizeof(buffer), FMT_COMPILE("{}"), 42);
     }
    

    Thanks @Kurkin (Dmitry Kurkin) <https://github.com/Kurkin>, @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>.

    • Added fmt::format_to overload that take text_style (#1593 <https://github.com/fmtlib/fmt/issues/1593>, #1842 <https://github.com/fmtlib/fmt/issues/1842>, #1843 <https://github.com/fmtlib/fmt/pull/1843>). For example (godbolt <https://godbolt.org/z/91153r>_):

    .. code:: c++

     #include <fmt/color.h>
    
     int main() {
       std::string out;
       fmt::format_to(std::back_inserter(out),
                      fmt::emphasis::bold | fg(fmt::color::red),
                      "The answer is {}.", 42);
     }
    

    Thanks @Naios (Denis Blank) <https://github.com/Naios>_.

    • Made the '#' specifier emit trailing zeros in addition to the decimal point (#1797 <https://github.com/fmtlib/fmt/issues/1797>). For example (godbolt <https://godbolt.org/z/bhdcW9>_):

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("{:#.2g}", 0.5);
     }
    

    prints 0.50.

    • πŸ”„ Changed the default floating point format to not include .0 for consistency with std::format and std::to_chars (#1893 <https://github.com/fmtlib/fmt/issues/1893>, #1943 <https://github.com/fmtlib/fmt/issues/1943>). It is possible to get the decimal point and trailing zero with the # specifier.

    • πŸ›  Fixed an issue with floating-point formatting that could result in addition of a non-significant trailing zero in rare cases e.g. 1.00e-34 instead of 1.0e-34 (#1873 <https://github.com/fmtlib/fmt/issues/1873>, #1917 <https://github.com/fmtlib/fmt/issues/1917>).

    • Made fmt::to_string fallback on ostream insertion operator if the formatter specialization is not provided (#1815 <https://github.com/fmtlib/fmt/issues/1815>, #1829 <https://github.com/fmtlib/fmt/pull/1829>). Thanks @alexezeder (Alexey Ochapov) <https://github.com/alexezeder>_.

    • βž• Added support for the append mode to the experimental file API and improved fcntl.h detection. (#1847 <https://github.com/fmtlib/fmt/pull/1847>, #1848 <https://github.com/fmtlib/fmt/pull/1848>). Thanks @t-wiser <https://github.com/t-wiser>_.

    • πŸ›  Fixed handling of types that have both an implicit conversion operator and an overloaded ostream insertion operator (#1766 <https://github.com/fmtlib/fmt/issues/1766>_).

    • πŸ›  Fixed a slicing issue in an internal iterator type (#1822 <https://github.com/fmtlib/fmt/pull/1822>). Thanks @BRevzin (Barry Revzin) <https://github.com/BRevzin>.

    • πŸ›  Fixed an issue in locale-specific integer formatting (#1927 <https://github.com/fmtlib/fmt/issues/1927>_).

    • πŸ›  Fixed handling of exotic code unit types (#1870 <https://github.com/fmtlib/fmt/issues/1870>, #1932 <https://github.com/fmtlib/fmt/issues/1932>).

    • Improved FMT_ALWAYS_INLINE (#1878 <https://github.com/fmtlib/fmt/pull/1878>). Thanks @jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>.

    • βœ‚ Removed dependency on windows.h (#1900 <https://github.com/fmtlib/fmt/pull/1900>). Thanks @bernd5 (Bernd Baumanns) <https://github.com/bernd5>.

    • ⚑️ Optimized counting of decimal digits on MSVC (#1890 <https://github.com/fmtlib/fmt/pull/1890>). Thanks @mwinterb <https://github.com/mwinterb>.

    • πŸ‘Œ Improved documentation (#1772 <https://github.com/fmtlib/fmt/issues/1772>, #1775 <https://github.com/fmtlib/fmt/pull/1775>, #1792 <https://github.com/fmtlib/fmt/pull/1792>, #1838 <https://github.com/fmtlib/fmt/pull/1838>, #1888 <https://github.com/fmtlib/fmt/pull/1888>, #1918 <https://github.com/fmtlib/fmt/pull/1918>, #1939 <https://github.com/fmtlib/fmt/pull/1939>). Thanks @leolchat (LΓ©onard GΓ©rard) <https://github.com/leolchat>, @pepsiman (Malcolm Parsons) <https://github.com/pepsiman>, @Klaim (JoΓ«l Lamotte) <https://github.com/Klaim>, @ravijanjam (Ravi J) <https://github.com/ravijanjam>, @francesco-st <https://github.com/francesco-st>, @udnaan (Adnan) <https://github.com/udnaan>_.

    • ⬇️ Added the FMT_REDUCE_INT_INSTANTIATIONS CMake option that reduces the binary code size at the cost of some integer formatting performance. This can be useful for extremely memory-constrained embedded systems (#1778 <https://github.com/fmtlib/fmt/issues/1778>, #1781 <https://github.com/fmtlib/fmt/pull/1781>). Thanks @kammce (Khalil Estell) <https://github.com/kammce>_.

    • πŸ‘‰ Added the FMT_USE_INLINE_NAMESPACES macro to control usage of inline namespaces (#1945 <https://github.com/fmtlib/fmt/pull/1945>). Thanks @darklukee <https://github.com/darklukee>.

    • πŸ‘Œ Improved build configuration (#1760 <https://github.com/fmtlib/fmt/pull/1760>, #1770 <https://github.com/fmtlib/fmt/pull/1770>, #1779 <https://github.com/fmtlib/fmt/issues/1779>, #1783 <https://github.com/fmtlib/fmt/pull/1783>, #1823 <https://github.com/fmtlib/fmt/pull/1823>). Thanks @dvetutnev (Dmitriy Vetutnev) <https://github.com/dvetutnev>, @xvitaly (Vitaly Zaitsev) <https://github.com/xvitaly>, @tambry (Raul Tambre) <https://github.com/tambry>, @medithe <https://github.com/medithe>, @martinwuehrer (Martin WΓΌhrer) <https://github.com/martinwuehrer>.

    • πŸ›  Fixed various warnings and compilation issues (#1790 <https://github.com/fmtlib/fmt/pull/1790>, #1802 <https://github.com/fmtlib/fmt/pull/1802>, #1808 <https://github.com/fmtlib/fmt/pull/1808>, #1810 <https://github.com/fmtlib/fmt/issues/1810>, #1811 <https://github.com/fmtlib/fmt/issues/1811>, #1812 <https://github.com/fmtlib/fmt/pull/1812>, #1814 <https://github.com/fmtlib/fmt/pull/1814>, #1816 <https://github.com/fmtlib/fmt/pull/1816>, #1817 <https://github.com/fmtlib/fmt/pull/1817>, #1818 <https://github.com/fmtlib/fmt/pull/1818>, #1825 <https://github.com/fmtlib/fmt/issues/1825>, #1836 <https://github.com/fmtlib/fmt/pull/1836>, #1855 <https://github.com/fmtlib/fmt/pull/1855>, #1856 <https://github.com/fmtlib/fmt/pull/1856>, #1860 <https://github.com/fmtlib/fmt/pull/1860>, #1877 <https://github.com/fmtlib/fmt/pull/1877>, #1879 <https://github.com/fmtlib/fmt/pull/1879>, #1880 <https://github.com/fmtlib/fmt/pull/1880>, #1896 <https://github.com/fmtlib/fmt/issues/1896>, #1897 <https://github.com/fmtlib/fmt/pull/1897>, #1898 <https://github.com/fmtlib/fmt/pull/1898>, #1904 <https://github.com/fmtlib/fmt/issues/1904>, #1908 <https://github.com/fmtlib/fmt/pull/1908>, #1911 <https://github.com/fmtlib/fmt/issues/1911>, #1912 <https://github.com/fmtlib/fmt/issues/1912>, #1928 <https://github.com/fmtlib/fmt/issues/1928>, #1929 <https://github.com/fmtlib/fmt/pull/1929>, #1935 <https://github.com/fmtlib/fmt/issues/1935> #1937 <https://github.com/fmtlib/fmt/pull/1937>, #1942 <https://github.com/fmtlib/fmt/pull/1942>, #1949 <https://github.com/fmtlib/fmt/issues/1949>). Thanks @TheQwertiest <https://github.com/TheQwertiest>, @medithe <https://github.com/medithe>, @martinwuehrer (Martin WΓΌhrer) <https://github.com/martinwuehrer>, @n16h7hunt3r <https://github.com/n16h7hunt3r>, @Othereum (Seokjin Lee) <https://github.com/Othereum>, @gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>, @AlexanderLanin (Alexander Lanin) <https://github.com/AlexanderLanin>, @gcerretani (Giovanni Cerretani) <https://github.com/gcerretani>, @chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>, @noizefloor (Jan Schwers) <https://github.com/noizefloor>, @akohlmey (Axel Kohlmeyer) <https://github.com/akohlmey>, @jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>, @rimathia <https://github.com/rimathia>, @rglarix (Riccardo Ghetta (larix)) <https://github.com/rglarix>, @moiwi <https://github.com/moiwi>, @heckad (Kazantcev Andrey) <https://github.com/heckad>, @MarcDirven <https://github.com/MarcDirven>. @BartSiwek (Bart Siwek) <https://github.com/BartSiwek>, @darklukee <https://github.com/darklukee>.

  • v7.0.3 Changes

    August 06, 2020
    • Worked around broken numeric_limits for 128-bit integers (#1787 <https://github.com/fmtlib/fmt/issues/1787>_).

    • βž• Added error reporting on missing named arguments (#1796 <https://github.com/fmtlib/fmt/issues/1796>_).

    • Stopped using 128-bit integers with clang-cl (#1800 <https://github.com/fmtlib/fmt/pull/1800>). Thanks @Kingcom <https://github.com/Kingcom>.

    • πŸ›  Fixed issues in locale-specific integer formatting (#1782 <https://github.com/fmtlib/fmt/issues/1782>, #1801 <https://github.com/fmtlib/fmt/issues/1801>).

  • v7.0.2 Changes

    July 29, 2020
    • Worked around broken numeric_limits for 128-bit integers (#1725 <https://github.com/fmtlib/fmt/issues/1725>_).

    • πŸ›  Fixed compatibility with CMake 3.4 (#1779 <https://github.com/fmtlib/fmt/issues/1779>_).

    • πŸ›  Fixed handling of digit separators in locale-specific formatting (#1782 <https://github.com/fmtlib/fmt/issues/1782>_).

  • v7.0.1 Changes

    July 07, 2020
    • ⚑️ Updated the inline version namespace name.

    • Worked around a gcc bug in mangling of alias templates (#1753 <https://github.com/fmtlib/fmt/issues/1753>_).

    • πŸ›  Fixed a linkage error on Windows (#1757 <https://github.com/fmtlib/fmt/issues/1757>). Thanks @Kurkin (Dmitry Kurkin) <https://github.com/Kurkin>.

    • πŸ›  Fixed minor issues with the documentation.

  • v7.0.0 Changes

    July 05, 2020
    • ⬇️ Reduced the library size. For example, on macOS a stripped test binary statically linked with {fmt} shrank from ~368k to less than 100k <http://www.zverovich.net/2020/05/21/reducing-library-size.html>_.

    • βž• Added a simpler and more efficient format string compilation API <https://fmt.dev/7.0.0/api.html#compile-api>_:

    .. code:: c++

     #include <fmt/compile.h>
    
     // Converts 42 into std::string using the most efficient method and no
     // runtime format string processing.
     std::string s = fmt::format(FMT_COMPILE("{}"), 42);
    

    The old fmt::compile API is now deprecated.

    • ⚑️ Optimized integer formatting: format_to with format string compilation and a stack-allocated buffer is now faster than to_chars on both libc++ and libstdc++ <http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html>_.

    • ⚑️ Optimized handling of small format strings. For example,

    .. code:: c++

      fmt::format("Result: {}: ({},{},{},{})", str1, str2, str3, str4, str5)
    

    is now ~40% faster (#1685 <https://github.com/fmtlib/fmt/issues/1685>_).

    • Applied extern templates to improve compile times when using the core API and fmt/format.h (#1452 <https://github.com/fmtlib/fmt/issues/1452>_). For example, on macOS with clang the compile time of a test translation unit dropped from 2.3s to 0.3s with -O2 and from 0.6s to 0.3s with the default settings (-O0).

    Before (-O2)::

    % time c++ -c test.cc -I include -std=c++17 -O2
    c++ -c test.cc -I include -std=c++17 -O2  2.22s user 0.08s system 99% cpu 2.311 total
    

    After (-O2)::

    % time c++ -c test.cc -I include -std=c++17 -O2
    c++ -c test.cc -I include -std=c++17 -O2  0.26s user 0.04s system 98% cpu 0.303 total
    

    Before (default)::

    % time c++ -c test.cc -I include -std=c++17
    c++ -c test.cc -I include -std=c++17  0.53s user 0.06s system 98% cpu 0.601 total
    

    After (default)::

    % time c++ -c test.cc -I include -std=c++17
    c++ -c test.cc -I include -std=c++17  0.24s user 0.06s system 98% cpu 0.301 total
    

    It is still recommended to use fmt/core.h instead of fmt/format.h but the compile time difference is now smaller. Thanks @alex3d <https://github.com/alex3d>_ for the suggestion.

    • Named arguments are now stored on stack (no dynamic memory allocations) and the compiled code is more compact and efficient. For example

    .. code:: c++

     #include <fmt/core.h>
    
     int main() {
       fmt::print("The answer is {answer}\n", fmt::arg("answer", 42));
     }
    

    compiles to just (godbolt <https://godbolt.org/z/NcfEp_>__)

    .. code:: asm

      .LC0:
              .string "answer"
      .LC1:
              .string "The answer is {answer}\n"
      main:
              sub     rsp, 56
              mov     edi, OFFSET FLAT:.LC1
              mov     esi, 23
              movabs  rdx, 4611686018427387905
              lea     rax, [rsp+32]
              lea     rcx, [rsp+16]
              mov     QWORD PTR [rsp+8], 1
              mov     QWORD PTR [rsp], rax
              mov     DWORD PTR [rsp+16], 42
              mov     QWORD PTR [rsp+32], OFFSET FLAT:.LC0
              mov     DWORD PTR [rsp+40], 0
              call    fmt::v6::vprint(fmt::v6::basic_string_view<char>,
                                      fmt::v6::format_args)
              xor     eax, eax
              add     rsp, 56
              ret
    
          .L.str.1:
                  .asciz  "answer"
    
    • Implemented compile-time checks for dynamic width and precision (#1614 <https://github.com/fmtlib/fmt/issues/1614>_):

    .. code:: c++

     #include <fmt/format.h>
    
     int main() {
       fmt::print(FMT_STRING("{0:{1}}"), 42);
     }
    

    now gives a compilation error because argument 1 doesn't exist::

    In file included from test.cc:1:
    include/fmt/format.h:2726:27: error: constexpr variable 'invalid_format' must be
    initialized by a constant expression
      FMT_CONSTEXPR_DECL bool invalid_format =
                              ^
    ...
    include/fmt/core.h:569:26: note: in call to
    '&checker(s, {}).context_->on_error(&"argument not found"[0])'
        if (id >= num_args_) on_error("argument not found");
                            ^
    
    • βž• Added sentinel support to fmt::join (#1689 <https://github.com/fmtlib/fmt/pull/1689>_)

    .. code:: c++

    struct zstring_sentinel {};
    bool operator==(const char* p, zstring_sentinel) { return *p == '\0'; }
    bool operator!=(const char* p, zstring_sentinel) { return *p != '\0'; }
    
    struct zstring {
      const char* p;
      const char* begin() const { return p; }
      zstring_sentinel end() const { return {}; }
    };
    
    auto s = fmt::format("{}", fmt::join(zstring{"hello"}, "_"));
    // s == "h_e_l_l_o"
    

    Thanks @BRevzin (Barry Revzin) <https://github.com/BRevzin>_.

    • βž• Added support for named arguments, clear and reserve to dynamic_format_arg_store (#1655 <https://github.com/fmtlib/fmt/issues/1655>, #1663 <https://github.com/fmtlib/fmt/pull/1663>, #1674 <https://github.com/fmtlib/fmt/pull/1674>, #1677 <https://github.com/fmtlib/fmt/pull/1677>). Thanks @vsolontsov-ll (Vladimir Solontsov) <https://github.com/vsolontsov-ll>_.

    • βž• Added support for the 'c' format specifier to integral types for compatibility with std::format (#1652 <https://github.com/fmtlib/fmt/issues/1652>_).

    • Replaced the 'n' format specifier with 'L' for compatibility with std::format (#1624 <https://github.com/fmtlib/fmt/issues/1624>_). The 'n' specifier can be enabled via the FMT_DEPRECATED_N_SPECIFIER macro.

    • 0️⃣ The '=' format specifier is now disabled by default for compatibility with std::format. It can be enabled via the FMT_DEPRECATED_NUMERIC_ALIGN macro.

    • βœ‚ Removed the following deprecated APIs:

      • FMT_STRING_ALIAS and fmt macros - replaced by FMT_STRING
      • fmt::basic_string_view::char_type - replaced by fmt::basic_string_view::value_type
      • convert_to_int
      • format_arg_store::types
      • *parse_context - replaced by *format_parse_context
      • FMT_DEPRECATED_INCLUDE_OS
      • FMT_DEPRECATED_PERCENT - incompatible with std::format
      • *writer - replaced by compiled format API
    • πŸ“‡ Renamed the internal namespace to detail (#1538 <https://github.com/fmtlib/fmt/issues/1538>_). The former is still provided as an alias if the FMT_USE_INTERNAL macro is defined.

    • πŸ‘Œ Improved compatibility between fmt::printf with the standard specs (#1595 <https://github.com/fmtlib/fmt/issues/1595>, #1682 <https://github.com/fmtlib/fmt/pull/1682>, #1683 <https://github.com/fmtlib/fmt/pull/1683>, #1687 <https://github.com/fmtlib/fmt/pull/1687>, #1699 <https://github.com/fmtlib/fmt/pull/1699>). Thanks @rimathia <https://github.com/rimathia>.

    • πŸ›  Fixed handling of operator<< overloads that use copyfmt (#1666 <https://github.com/fmtlib/fmt/issues/1666>_).

    • βž• Added the FMT_OS CMake option to control inclusion of OS-specific APIs in the fmt target. This can be useful for embedded platforms (#1654 <https://github.com/fmtlib/fmt/issues/1654>, #1656 <https://github.com/fmtlib/fmt/pull/1656>). Thanks @kwesolowski (Krzysztof Wesolowski) <https://github.com/kwesolowski>_.

    • πŸ— Replaced FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION with the FMT_FUZZ macro to prevent interferring with fuzzing of projects using {fmt} (#1650 <https://github.com/fmtlib/fmt/pull/1650>). Thanks @asraa (Asra Ali) <https://github.com/asraa>.

    • πŸ›  Fixed compatibility with emscripten (#1636 <https://github.com/fmtlib/fmt/issues/1636>, #1637 <https://github.com/fmtlib/fmt/pull/1637>). Thanks @ArthurSonzogni (Arthur Sonzogni) <https://github.com/ArthurSonzogni>_.

    • πŸ‘Œ Improved documentation (#704 <https://github.com/fmtlib/fmt/issues/704>, #1643 <https://github.com/fmtlib/fmt/pull/1643>, #1660 <https://github.com/fmtlib/fmt/pull/1660>, #1681 <https://github.com/fmtlib/fmt/pull/1681>, #1691 <https://github.com/fmtlib/fmt/pull/1691>, #1706 <https://github.com/fmtlib/fmt/pull/1706>, #1714 <https://github.com/fmtlib/fmt/pull/1714>, #1721 <https://github.com/fmtlib/fmt/pull/1721>, #1739 <https://github.com/fmtlib/fmt/pull/1739>, #1740 <https://github.com/fmtlib/fmt/pull/1740>, #1741 <https://github.com/fmtlib/fmt/pull/1741>, #1751 <https://github.com/fmtlib/fmt/pull/1751>). Thanks @senior7515 (Alexander Gallego) <https://github.com/senior7515>, @lsr0 (Lindsay Roberts) <https://github.com/lsr0>, @puetzk (Kevin Puetz) <https://github.com/puetzk>, @fpelliccioni (Fernando Pelliccioni) <https://github.com/fpelliccioni>, Alexey Kuzmenko, @jelly (jelle van der Waa) <https://github.com/jelly>, @claremacrae (Clare Macrae) <https://github.com/claremacrae>, @jiapengwen (文佳鹏) <https://github.com/jiapengwen>, @gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>, @alexey-milovidov <https://github.com/alexey-milovidov>_.

    • πŸ— Implemented various build configuration fixes and improvements (#1603 <https://github.com/fmtlib/fmt/pull/1603>, #1657 <https://github.com/fmtlib/fmt/pull/1657>, #1702 <https://github.com/fmtlib/fmt/pull/1702>, #1728 <https://github.com/fmtlib/fmt/pull/1728>). Thanks @scramsby (Scott Ramsby) <https://github.com/scramsby>, @jtojnar (Jan Tojnar) <https://github.com/jtojnar>, @orivej (Orivej Desh) <https://github.com/orivej>, @flagarde <https://github.com/flagarde>.

    • πŸ›  Fixed various warnings and compilation issues (#1616 <https://github.com/fmtlib/fmt/pull/1616>, #1620 <https://github.com/fmtlib/fmt/issues/1620>, #1622 <https://github.com/fmtlib/fmt/issues/1622>, #1625 <https://github.com/fmtlib/fmt/issues/1625>, #1627 <https://github.com/fmtlib/fmt/pull/1627>, #1628 <https://github.com/fmtlib/fmt/issues/1628>, #1629 <https://github.com/fmtlib/fmt/pull/1629>, #1631 <https://github.com/fmtlib/fmt/issues/1631>, #1633 <https://github.com/fmtlib/fmt/pull/1633>, #1649 <https://github.com/fmtlib/fmt/pull/1649>, #1658 <https://github.com/fmtlib/fmt/issues/1658>, #1661 <https://github.com/fmtlib/fmt/pull/1661>, #1667 <https://github.com/fmtlib/fmt/pull/1667>, #1668 <https://github.com/fmtlib/fmt/issues/1668>, #1669 <https://github.com/fmtlib/fmt/pull/1669>, #1692 <https://github.com/fmtlib/fmt/issues/1692>, #1696 <https://github.com/fmtlib/fmt/pull/1696>, #1697 <https://github.com/fmtlib/fmt/pull/1697>, #1707 <https://github.com/fmtlib/fmt/issues/1707>, #1712 <https://github.com/fmtlib/fmt/pull/1712>, #1716 <https://github.com/fmtlib/fmt/pull/1716>, #1722 <https://github.com/fmtlib/fmt/pull/1722>, #1724 <https://github.com/fmtlib/fmt/issues/1724>, #1729 <https://github.com/fmtlib/fmt/pull/1729>, #1738 <https://github.com/fmtlib/fmt/pull/1738>, #1742 <https://github.com/fmtlib/fmt/issues/1742>, #1743 <https://github.com/fmtlib/fmt/issues/1743>, #1744 <https://github.com/fmtlib/fmt/pull/1744>, #1747 <https://github.com/fmtlib/fmt/issues/1747>, #1750 <https://github.com/fmtlib/fmt/pull/1750>). Thanks @gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>, @gabime (Gabi Melman) <https://github.com/gabime>, @johnor (Johan) <https://github.com/johnor>, @Kurkin (Dmitry Kurkin) <https://github.com/Kurkin>, @invexed (James Beach) <https://github.com/invexed>, @peterbell10 <https://github.com/peterbell10>, @daixtrose (Markus Werle) <https://github.com/daixtrose>, @petrutlucian94 (Lucian Petrut) <https://github.com/petrutlucian94>, @Neargye (Daniil Goncharov) <https://github.com/Neargye>, @ambitslix (Attila M. Szilagyi) <https://github.com/ambitslix>, @gabime (Gabi Melman) <https://github.com/gabime>, @erthink (Leonid Yuriev) <https://github.com/erthink>, @tohammer (Tobias Hammer) <https://github.com/tohammer>, @0x8000-0000 (Florin Iucha) <https://github.com/0x8000-0000>.