All Versions
35
Latest Version
Avg Release Cycle
72 days
Latest Release
98 days ago

Changelog History
Page 1

  • v7.1.3

    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

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

    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

    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

    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

    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

    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

    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>.

  • v6.2.1

    May 09, 2020
    • πŸ›  Fixed ostream support in sprintf (#1631 <https://github.com/fmtlib/fmt/issues/1631>_).

    • πŸ›  Fixed type detection when using implicit conversion to string_view and ostream operator<< inconsistently (#1662 <https://github.com/fmtlib/fmt/issues/1662>_).

  • v6.2.0

    April 05, 2020
    • πŸ‘Œ Improved error reporting when trying to format an object of a non-formattable type:

    .. code:: c++

     fmt::format("{}", S());
    

    now gives::

    include/fmt/core.h:1015:5: error: static_assert failed due to requirement
    'formattable' "Cannot format argument. To make type T formattable provide a
    formatter<T> specialization:
    https://fmt.dev/latest/api.html#formatting-user-defined-types"
        static_assert(
        ^
    ...
    note: in instantiation of function template specialization
    'fmt::v6::format<char [3], S, char>' requested here
      fmt::format("{}", S());
           ^
    

    if S is not formattable.

    • ⬇️ Reduced the library size by ~10%.

    • πŸ–¨ Always print decimal point if # is specified (#1476 <https://github.com/fmtlib/fmt/issues/1476>, #1498 <https://github.com/fmtlib/fmt/issues/1498>):

    .. code:: c++

     fmt::print("{:#.0f}", 42.0);
    

    now prints 42.

    • Implemented the 'L' specifier for locale-specific numeric formatting to improve compatibility with std::format. The 'n' specifier is now deprecated and will be removed in the next major release.

    • 🏁 Moved OS-specific APIs such as windows_error from fmt/format.h to fmt/os.h. You can define FMT_DEPRECATED_INCLUDE_OS to automatically include fmt/os.h from fmt/format.h for compatibility but this will be disabled in the next major release.

    • βž• Added precision overflow detection in floating-point formatting.

    • Implemented detection of invalid use of fmt::arg.

    • πŸ‘‰ Used type_identity to block unnecessary template argument deduction. Thanks Tim Song.

    • πŸ‘Œ Improved UTF-8 handling (#1109 <https://github.com/fmtlib/fmt/issues/1109>_):

    .. code:: c++

     fmt::print("β”Œ{0:─^{2}}┐\n"
                "β”‚{1: ^{2}}β”‚\n"
                "β””{0:─^{2}}β”˜\n", "", "ΠŸΡ€ΠΈΠ²Π΅Ρ‚, ΠΌΠΈΡ€!", 20);
    

    now prints::

     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚    ΠŸΡ€ΠΈΠ²Π΅Ρ‚, ΠΌΠΈΡ€!    β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    

    on systems that support Unicode.

    • βž• Added experimental dynamic argument storage (#1170 <https://github.com/fmtlib/fmt/issues/1170>, #1584 <https://github.com/fmtlib/fmt/pull/1584>):

    .. code:: c++

     fmt::dynamic_format_arg_store<fmt::format_context> store;
     store.push_back("answer");
     store.push_back(42);
     fmt::vprint("The {} is {}.\n", store);
    

    prints::

     The answer is 42.
    

    Thanks @vsolontsov-ll (Vladimir Solontsov) <https://github.com/vsolontsov-ll>_.

    • Made fmt::join accept initializer_list (#1591 <https://github.com/fmtlib/fmt/pull/1591>). Thanks @Rapotkinnik (Nikolay Rapotkin) <https://github.com/Rapotkinnik>.

    • πŸ›  Fixed handling of empty tuples (#1588 <https://github.com/fmtlib/fmt/issues/1588>_).

    • Fixed handling of output iterators in format_to_n (#1506 <https://github.com/fmtlib/fmt/issues/1506>_).

    • πŸ›  Fixed formatting of std::chrono::duration types to wide output (#1533 <https://github.com/fmtlib/fmt/pull/1533>). Thanks @zeffy (pilao) <https://github.com/zeffy>.

    • βž• Added const begin and end overload to buffers (#1553 <https://github.com/fmtlib/fmt/pull/1553>). Thanks @dominicpoeschko <https://github.com/dominicpoeschko>.

    • πŸ‘‰ Added the ability to disable floating-point formatting via FMT_USE_FLOAT, FMT_USE_DOUBLE and FMT_USE_LONG_DOUBLE macros for extremely memory-constrained embedded system (#1590 <https://github.com/fmtlib/fmt/pull/1590>). Thanks @albaguirre (Alberto Aguirre) <https://github.com/albaguirre>.

    • Made FMT_STRING work with constexpr string_view (#1589 <https://github.com/fmtlib/fmt/pull/1589>). Thanks @scramsby (Scott Ramsby) <https://github.com/scramsby>.

    • πŸ“œ Implemented a minor optimization in the format string parser (#1560 <https://github.com/fmtlib/fmt/pull/1560>). Thanks @IkarusDeveloper <https://github.com/IkarusDeveloper>.

    • πŸ‘Œ Improved attribute detection (#1469 <https://github.com/fmtlib/fmt/pull/1469>, #1475 <https://github.com/fmtlib/fmt/pull/1475>, #1576 <https://github.com/fmtlib/fmt/pull/1576>). Thanks @federico-busato (Federico) <https://github.com/federico-busato>, @chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>, @refnum <https://github.com/refnum>.

    • πŸ‘Œ Improved documentation (#1481 <https://github.com/fmtlib/fmt/pull/1481>, #1523 <https://github.com/fmtlib/fmt/pull/1523>). Thanks @JackBoosY (JackΒ·BoosΒ·Yu) <https://github.com/JackBoosY>, @imba-tjd (谭九鼎) <https://github.com/imba-tjd>.

    • πŸ›  Fixed symbol visibility on Linux when compiling with -fvisibility=hidden (#1535 <https://github.com/fmtlib/fmt/pull/1535>). Thanks @milianw (Milian Wolff) <https://github.com/milianw>.

    • πŸ— Implemented various build configuration fixes and improvements (#1264 <https://github.com/fmtlib/fmt/issues/1264>, #1460 <https://github.com/fmtlib/fmt/issues/1460>, #1534 <https://github.com/fmtlib/fmt/pull/1534>, #1536 <https://github.com/fmtlib/fmt/issues/1536>, #1545 <https://github.com/fmtlib/fmt/issues/1545>, #1546 <https://github.com/fmtlib/fmt/pull/1546>, #1566 <https://github.com/fmtlib/fmt/issues/1566>, #1582 <https://github.com/fmtlib/fmt/pull/1582>, #1597 <https://github.com/fmtlib/fmt/issues/1597>, #1598 <https://github.com/fmtlib/fmt/pull/1598>). Thanks @ambitslix (Attila M. Szilagyi) <https://github.com/ambitslix>, @jwillikers (Jordan Williams) <https://github.com/jwillikers>, @stac47 (Laurent Stacul) <https://github.com/stac47>_.

    • πŸ›  Fixed various warnings and compilation issues (#1433 <https://github.com/fmtlib/fmt/pull/1433>, #1461 <https://github.com/fmtlib/fmt/issues/1461>, #1470 <https://github.com/fmtlib/fmt/pull/1470>, #1480 <https://github.com/fmtlib/fmt/pull/1480>, #1485 <https://github.com/fmtlib/fmt/pull/1485>, #1492 <https://github.com/fmtlib/fmt/pull/1492>, #1493 <https://github.com/fmtlib/fmt/issues/1493>, #1504 <https://github.com/fmtlib/fmt/issues/1504>, #1505 <https://github.com/fmtlib/fmt/pull/1505>, #1512 <https://github.com/fmtlib/fmt/pull/1512>, #1515 <https://github.com/fmtlib/fmt/issues/1515>, #1516 <https://github.com/fmtlib/fmt/pull/1516>, #1518 <https://github.com/fmtlib/fmt/pull/1518>, #1519 <https://github.com/fmtlib/fmt/pull/1519>, #1520 <https://github.com/fmtlib/fmt/pull/1520>, #1521 <https://github.com/fmtlib/fmt/pull/1521>, #1522 <https://github.com/fmtlib/fmt/pull/1522>, #1524 <https://github.com/fmtlib/fmt/issues/1524>, #1530 <https://github.com/fmtlib/fmt/pull/1530>, #1531 <https://github.com/fmtlib/fmt/issues/1531>, #1532 <https://github.com/fmtlib/fmt/pull/1532>, #1539 <https://github.com/fmtlib/fmt/issues/1539>, #1547 <https://github.com/fmtlib/fmt/issues/1547>, #1548 <https://github.com/fmtlib/fmt/issues/1548>, #1554 <https://github.com/fmtlib/fmt/pull/1554>, #1567 <https://github.com/fmtlib/fmt/issues/1567>, #1568 <https://github.com/fmtlib/fmt/pull/1568>, #1569 <https://github.com/fmtlib/fmt/pull/1569>, #1571 <https://github.com/fmtlib/fmt/pull/1571>, #1573 <https://github.com/fmtlib/fmt/pull/1573>, #1575 <https://github.com/fmtlib/fmt/pull/1575>, #1581 <https://github.com/fmtlib/fmt/pull/1581>, #1583 <https://github.com/fmtlib/fmt/issues/1583>, #1586 <https://github.com/fmtlib/fmt/issues/1586>, #1587 <https://github.com/fmtlib/fmt/issues/1587>, #1594 <https://github.com/fmtlib/fmt/issues/1594>, #1596 <https://github.com/fmtlib/fmt/pull/1596>, #1604 <https://github.com/fmtlib/fmt/issues/1604>, #1606 <https://github.com/fmtlib/fmt/pull/1606>, #1607 <https://github.com/fmtlib/fmt/issues/1607>, #1609 <https://github.com/fmtlib/fmt/issues/1609>). Thanks @marti4d (Chris Martin) <https://github.com/marti4d>, @iPherian <https://github.com/iPherian>, @parkertomatoes <https://github.com/parkertomatoes>, @gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>, @chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>, @DanielaE (Daniela Engert) <https://github.com/DanielaE>, @torsten48 <https://github.com/torsten48>, @tohammer (Tobias Hammer) <https://github.com/tohammer>, @lefticus (Jason Turner) <https://github.com/lefticus>, @ryusakki (Haise) <https://github.com/ryusakki>, @adnsv (Alex Denisov) <https://github.com/adnsv>, @fghzxm <https://github.com/fghzxm>, @refnum <https://github.com/refnum>, @pramodk (Pramod Kumbhar) <https://github.com/pramodk>, @Spirrwell <https://github.com/Spirrwell>, @scramsby (Scott Ramsby) <https://github.com/scramsby>_.