Skip to content

Latest commit

 

History

History
3050 lines (2425 loc) · 109 KB

File metadata and controls

3050 lines (2425 loc) · 109 KB

11.2.0 - TBD

  • Added the s specifier for std::error_code. It allows formatting an error message as a string. For example:

    #include <fmt/std.h>
    
    int main() {
      auto ec = std::make_error_code(std::errc::no_such_file_or_directory);
      fmt::print("{:s}\n", ec);
    }

    prints

    No such file or directory
    

    (The actual message is platform-specific.)

  • Fixed formatting of std::chrono::local_time (fmtlib#3815, fmtlib#4350). For example (godbolt):

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

    is now formatted consistenly across platforms.

  • Added diagnostics for cases when timezone information is not available. For example:

    fmt::print("{:Z}", std::chrono::local_seconds());

    now gives a compile-time error.

  • Deprecated fmt::localtime in favor of std::localtime.

  • Fixed compilation with GCC 15 and C++20 modules enabled (fmtlib#4347). Thanks @tkhyn.

  • Fixed handling of named arguments in format specs (fmtlib#4360, fmtlib#4361). Thanks @dinomight.

  • Added error reporting for duplicate named arguments (fmtlib#4367). Thanks @dinomight.

  • Fixed formatting of long with FMT_BUILTIN_TYPES=0 (fmtlib#4375, fmtlib#4394).

  • Optimized text_style using bit packing (fmtlib#4363). Thanks @LocalSpook.

  • Added support for incomplete types (fmtlib#3180, fmtlib#4383). Thanks @LocalSpook.

  • Fixed a flush issue in fmt::print when using libstdc++ (fmtlib#4398).

  • Fixed fmt::println usage with FMT_ENFORCE_COMPILE_STRING and legacy compile-time checks (fmtlib#4407). Thanks @madmaxoft.

  • Removed legacy header fmt/core.h from docs (fmtlib#4421, fmtlib#4422). Thanks @krzysztofkortas.

  • Worked around limitations of __builtin_strlen during constant evaluation (fmtlib#4423, fmtlib#4429). Thanks @BRevzin.

  • Worked around a bug in MSVC v141 (fmtlib#4412, fmtlib#4413). Thanks @hirohira9119.

  • Removed the fmt_detail namespace (fmtlib#4324).

  • Removed specializations of std::is_floating_point in tests (fmtlib#4417).

  • Fixed a CMake error when setting CMAKE_MODULE_PATH in the pedantic mode (fmtlib#4426). Thanks @rlalik.

  • Updated the Bazel config (fmtlib#4400). Thanks @Vertexwahn.

11.1.4 - 2025-02-26

  • Fixed ABI compatibility with earlier 11.x versions on Windows (fmtlib#4359).

  • Improved the logic of switching between fixed and exponential format for float (fmtlib#3649).

  • Moved is_compiled_string to the public API (fmtlib#4342). Thanks @SwooshyCueb.

  • Simplified implementation of operator""_cf (fmtlib#4349). Thanks @LocalSpook.

  • Fixed __builtin_strlen detection (fmtlib#4329). Thanks @LocalSpook.

  • Fixed handling of BMI paths with the Ninja generator (fmtlib#4344). Thanks @tkhyn.

  • Fixed gcc 8.3 compile errors (fmtlib#4331, fmtlib#4336). Thanks @sergiud.

  • Fixed a bogus MSVC warning (fmtlib#4356). Thanks @dinomight.

11.1.3 - 2025-01-25

  • Fixed compilation on GCC 9.4 (fmtlib#4313).

  • Worked around an internal compiler error when using C++20 modules with GCC 14.2 and earlier (fmtlib#4295).

  • Worked around a bug in GCC 6 (fmtlib#4318).

  • Fixed an issue caused by instantiating formatter<const T> (fmtlib#4303, fmtlib#4325). Thanks @timsong-cpp.

  • Fixed formatting into std::ostreambuf_iterator when using format string compilation (fmtlib#4309, fmtlib#4312). Thanks @phprus.

  • Restored a constraint on the map formatter so that it correctly reports as unformattable when the element is (fmtlib#4326). Thanks @timsong-cpp.

  • Reduced the size of format specs (fmtlib#4298).

  • Readded args() to fmt::format_context (fmtlib#4307, fmtlib#4310). Thanks @Erroneous1.

  • Fixed a bogus MSVC warning (fmtlib#4314, fmtlib#4322). Thanks @ZehMatt.

  • Fixed a pedantic mode error in the CMake config (fmtlib#4327). Thanks @rlalik.

11.1.2 - 2025-01-12

11.1.1 - 2024-12-27

  • Fixed ABI compatibility with earlier 11.x versions (fmtlib#4278).

  • Defined CMake components (core and doc) to allow docs to be installed separately (fmtlib#4276). Thanks @carlsmedstad.

11.1.0 - 2024-12-25

11.0.2 - 2024-07-20

  • Fixed compatibility with non-POSIX systems (fmtlib#4054, fmtlib#4060).

  • Fixed performance regressions when using std::back_insert_iterator with fmt::format_to (fmtlib#4070).

  • Fixed handling of std::generator and move-only iterators (fmtlib#4053, fmtlib#4057). Thanks @Arghnews.

  • Made formatter<std::string_view>::parse work with types convertible to std::string_view (fmtlib#4036, fmtlib#4055). Thanks @Arghnews.

  • Made volatile void* formattable (fmtlib#4049, fmtlib#4056). Thanks @Arghnews.

  • Made Glib::ustring not be confused with std::string (fmtlib#4052).

  • Made fmt::context iterator compatible with STL algorithms that rely on iterator category (fmtlib#4079).

11.0.1 - 2024-07-05

  • Fixed version number in the inline namespace (fmtlib#4047).

  • Fixed disabling Unicode support via CMake (fmtlib#4051).

  • Fixed deprecated visit_format_arg (fmtlib#4043). Thanks @nebkat.

  • Fixed handling of a sign and improved the std::complex formater (fmtlib#4034, fmtlib#4050). Thanks @tesch1 and @phprus.

  • Fixed ADL issues in fmt::printf when using C++20 (fmtlib#4042). Thanks @toge.

  • Removed a redundant check in the formatter for std::expected (fmtlib#4040). Thanks @phprus.

11.0.0 - 2024-07-01

  • Added fmt/base.h which provides a subset of the API with minimal include dependencies and enough functionality to replace all uses of the printf family of functions. This brings the compile time of code using {fmt} much closer to the equivalent printf code as shown on the following benchmark that compiles 100 source files:

    Method Compile Time (s)
    printf 1.6
    IOStreams 25.9
    fmt 10.x 19.0
    fmt 11.0 4.8
    tinyformat 29.1
    Boost Format 55.0

    This gives almost 4x improvement in build speed compared to version 10. Note that the benchmark is purely formatting code and includes. In real projects the difference from printf will be smaller partly because common standard headers will be included in almost any translation unit (TU) anyway. In particular, in every case except printf above ~1s is spent in total on including <type_traits> in all TUs.

  • Optimized includes in other headers such as fmt/format.h which is now roughly equivalent to the old fmt/core.h in terms of build speed.

  • Migrated the documentation at https://fmt.dev/ from Sphinx to MkDocs.

  • Improved C++20 module support (fmtlib#3990, fmtlib#3991, fmtlib#3993, fmtlib#3994, fmtlib#3997, fmtlib#3998, fmtlib#4004, fmtlib#4005, fmtlib#4006, fmtlib#4013, fmtlib#4027, fmtlib#4029). In particular, native CMake support for modules is now used if available. Thanks @yujincheng08 and @matt77hias.

  • Added an option to replace standard includes with import std enabled via the FMT_IMPORT_STD macro (fmtlib#3921, fmtlib#3928). Thanks @matt77hias.

  • Exported fmt::range_format, fmt::range_format_kind and fmt::compiled_string from the fmt module (fmtlib#3970, fmtlib#3999). Thanks @matt77hias and @yujincheng08.

  • Improved integration with stdio in fmt::print, enabling direct writes into a C stream buffer in common cases. This may give significant performance improvements ranging from tens of percent to 2x and eliminates dynamic memory allocations on the buffer level. It is currently enabled for built-in and string types with wider availability coming up in future releases.

    For example, it gives ~24% improvement on a simple benchmark compiled with Apple clang version 15.0.0 (clang-1500.1.0.2.5) and run on macOS 14.2.1:

    -------------------------------------------------------
    Benchmark             Time             CPU   Iterations
    -------------------------------------------------------
    printf             81.8 ns         81.5 ns      8496899
    fmt::print (10.x)  63.8 ns         61.9 ns     11524151
    fmt::print (11.0)  51.3 ns         51.0 ns     13846580
    
  • Improved safety of fmt::format_to when writing to an array (fmtlib#3805). For example (godbolt):

    auto volkswagen = char[4];
    auto result = fmt::format_to(volkswagen, "elephant");

    no longer results in a buffer overflow. Instead the output will be truncated and you can get the end iterator and whether truncation occurred from the result object. Thanks @ThePhD.

  • Enabled Unicode support by default in MSVC, bringing it on par with other compilers and making it unnecessary for users to enable it explicitly. Most of {fmt} is encoding-agnostic but this prevents mojibake in places where encoding matters such as path formatting and terminal output. You can control the Unicode support via the CMake FMT_UNICODE option. Note that some {fmt} packages such as the one in vcpkg have already been compiled with Unicode enabled.

  • Added a formatter for std::expected (fmtlib#3834). Thanks @dominicpoeschko.

  • Added a formatter for std::complex (fmtlib#1467, fmtlib#3886, fmtlib#3892, fmtlib#3900). Thanks @phprus.

  • Added a formatter for std::type_info (fmtlib#3978). Thanks @matt77hias.

  • Specialized formatter for std::basic_string types with custom traits and allocators (fmtlib#3938, fmtlib#3943). Thanks @dieram3.

  • Added formatters for std::chrono::day, std::chrono::month, std::chrono::year and std::chrono::year_month_day (fmtlib#3758, fmtlib#3772, fmtlib#3906, fmtlib#3913). For example:

    #include <fmt/chrono.h>
    #include <fmt/color.h>
    
    int main() {
      fmt::print(fg(fmt::color::green), "{}\n", std::chrono::day(7));
    }

    prints a green day:

    image

    Thanks @zivshek.

  • Fixed handling of precision in %S (fmtlib#3794, fmtlib#3814). Thanks @js324.

  • Added support for the - specifier (glibc strftime extension) to day of the month (%d) and week of the year (%W, %U, %V) specifiers (fmtlib#3976). Thanks @ZaheenJ.

  • Fixed the scope of the - extension in chrono formatting so that it doesn't apply to subsequent specifiers (fmtlib#3811, fmtlib#3812). Thanks @phprus.

  • Improved handling of time_point::min() (fmtlib#3282).

  • Added support for character range formatting (fmtlib#3857, fmtlib#3863). Thanks @js324.

  • Added string and debug_string range formatters (fmtlib#3973, fmtlib#4024). Thanks @matt77hias.

  • Enabled ADL for begin and end in fmt::join (fmtlib#3813, fmtlib#3824). Thanks @bbolli.

  • Made contiguous iterator optimizations apply to std::basic_string iterators (fmtlib#3798). Thanks @phprus.

  • Added support for ranges with mutable begin and end (fmtlib#3752, fmtlib#3800, fmtlib#3955). Thanks @tcbrindle and @Arghnews.

  • Added support for move-only iterators to fmt::join (fmtlib#3802, fmtlib#3946). Thanks @Arghnews.

  • Moved range and iterator overloads of fmt::join to fmt/ranges.h, next to other overloads.

  • Fixed handling of types with begin returning void such as Eigen matrices (fmtlib#3839, fmtlib#3964). Thanks @Arghnews.

  • Added an fmt::formattable concept (fmtlib#3974). Thanks @matt77hias.

  • Added support for __float128 (fmtlib#3494).

  • Fixed rounding issues when formatting long double with fixed precision (fmtlib#3539).

  • Made fmt::isnan not trigger floating-point exception for NaN values (fmtlib#3948, fmtlib#3951). Thanks @alexdewar.

  • Removed dependency on <memory> for std::allocator_traits when possible (fmtlib#3804). Thanks @phprus.

  • Enabled compile-time checks in formatting functions that take text colors and styles.

  • Deprecated wide stream overloads of fmt::print that take text styles.

  • Made format string compilation work with clang 12 and later despite only partial non-type template parameter support (fmtlib#4000, fmtlib#4001). Thanks @yujincheng08.

  • Made fmt::iterator_buffer's move constructor noexcept (fmtlib#3808). Thanks @waywardmonkeys.

  • Started enforcing that formatter::format is const for compatibility with std::format (fmtlib#3447).

  • Added fmt::basic_format_arg::visit and deprecated fmt::visit_format_arg.

  • Made fmt::basic_string_view not constructible from nullptr for consistency with std::string_view in C++23 (fmtlib#3846). Thanks @dalle.

  • Fixed fmt::group_digits for negative integers (fmtlib#3891, fmtlib#3901). Thanks @phprus.

  • Fixed handling of negative ids in fmt::basic_format_args::get (fmtlib#3945). Thanks @marlenecota.

  • Fixed handling of a buffer boundary on flush (fmtlib#4229).

  • Improved named argument validation (fmtlib#3817).

  • Disabled copy construction/assignment for fmt::format_arg_store and fixed moved construction (fmtlib#3833). Thanks @ivafanas.

  • Worked around a locale issue in RHEL/devtoolset (fmtlib#3858, fmtlib#3859). Thanks @g199209.

  • Added RTTI detection for MSVC (fmtlib#3821, fmtlib#3963). Thanks @edo9300.

  • Migrated the documentation from Sphinx to MkDocs.

  • Improved documentation and README (fmtlib#3775, fmtlib#3784, fmtlib#3788, fmtlib#3789, fmtlib#3793, fmtlib#3818, fmtlib#3820, fmtlib#3822, fmtlib#3843, fmtlib#3890, fmtlib#3894, fmtlib#3895, fmtlib#3905, fmtlib#3942, fmtlib#4008). Thanks @zencatalyst, WolleTD, @tupaschoal, @Dobiasd, @frank-weinberg, @bbolli, @phprus, @waywardmonkeys, @js324 and @tchaikov.

  • Improved CI and tests (fmtlib#3878, fmtlib#3883, fmtlib#3897, fmtlib#3979, fmtlib#3980, fmtlib#3988, fmtlib#4010, fmtlib#4012, fmtlib#4038). Thanks @vgorrX, @waywardmonkeys, @tchaikov and @phprus.

  • Fixed buffer overflow when using format string compilation with debug format and std::back_insert_iterator (fmtlib#3795, fmtlib#3797). Thanks @phprus.

  • Improved Bazel support (fmtlib#3792, fmtlib#3801, fmtlib#3962, fmtlib#3965). Thanks @Vertexwahn.

  • Improved/fixed the CMake config (fmtlib#3777, fmtlib#3783, fmtlib#3847, fmtlib#3907). Thanks @phprus and @xTachyon.

  • Fixed various warnings and compilation issues (fmtlib#3685, fmtlib#3769, fmtlib#3796, fmtlib#3803, fmtlib#3806, fmtlib#3807, fmtlib#3809, fmtlib#3810, fmtlib#3830, fmtlib#3832, fmtlib#3835, fmtlib#3844, fmtlib#3854, fmtlib#3856, fmtlib#3865, fmtlib#3866, fmtlib#3880, fmtlib#3881, fmtlib#3884, fmtlib#3898, fmtlib#3899, fmtlib#3909, fmtlib#3917, fmtlib#3923, fmtlib#3924, fmtlib#3925, fmtlib#3930, fmtlib#3931, fmtlib#3933, fmtlib#3935, fmtlib#3937, fmtlib#3967, fmtlib#3968, fmtlib#3972, fmtlib#3983, fmtlib#3992, fmtlib#3995, fmtlib#4009, fmtlib#4023). Thanks @hmbj, @phprus, @res2k, @Baardi, @matt77hias, @waywardmonkeys, @hmbj, @yakra, @prlw1, @Arghnews, @mtillmann0, @ShifftC, @eepp, @jimmy-park and @ChristianGebhardt.

10.2.1 - 2024-01-04

10.2.0 - 2024-01-01

10.1.1 - 2023-08-28

10.1.0 - 2023-08-12

  • Optimized format string compilation resulting in up to 40% speed up in compiled format_to and ~4x speed up in compiled format_to_n on a concatenation benchmark (fmtlib#3133, fmtlib#3484).

    {fmt} 10.0:

    ---------------------------------------------------------
    Benchmark               Time             CPU   Iterations
    ---------------------------------------------------------
    BM_format_to         78.9 ns         78.9 ns      8881746
    BM_format_to_n        568 ns          568 ns      1232089
    

    {fmt} 10.1:

    ---------------------------------------------------------
    Benchmark               Time             CPU   Iterations
    ---------------------------------------------------------
    BM_format_to         54.9 ns         54.9 ns     12727944
    BM_format_to_n        133 ns          133 ns      5257795
    
  • Optimized storage of an empty allocator in basic_memory_buffer (fmtlib#3485). Thanks @Minty-Meeo.

  • Added formatters for proxy references to elements of std::vector<bool> and std::bitset<N> (fmtlib#3567, fmtlib#3570). For example (godbolt):

    #include <vector>
    #include <fmt/std.h>
    
    int main() {
      auto v = std::vector<bool>{true};
      fmt::print("{}", v[0]);
    }

    Thanks @phprus and @felix642.

  • Fixed an ambiguous formatter specialization for containers that look like container adaptors such as boost::flat_set (fmtlib#3556, fmtlib#3561). Thanks @5chmidti.

  • Fixed compilation when formatting durations not convertible from std::chrono::seconds (fmtlib#3430). Thanks @patlkli.

  • Made the formatter specialization for char* const-correct (fmtlib#3432). Thanks @timsong-cpp.

  • Made {} and {:} handled consistently during compile-time checks (fmtlib#3526).

  • Disallowed passing temporaries to make_format_args to improve API safety by preventing dangling references.

  • Improved the compile-time error for unformattable types (fmtlib#3478). Thanks @BRevzin.

  • Improved the floating-point formatter (fmtlib#3448, fmtlib#3450). Thanks @florimond-collette.

  • Fixed handling of precision for long double larger than 64 bits. (fmtlib#3539, fmtlib#3564).

  • Made floating-point and chrono tests less platform-dependent (fmtlib#3337, fmtlib#3433, fmtlib#3434). Thanks @phprus.

  • Removed the remnants of the Grisu floating-point formatter that has been replaced by Dragonbox in earlier versions.

  • Added throw_format_error to the public API (fmtlib#3551). Thanks @mjerabek.

  • Made FMT_THROW assert even if assertions are disabled when compiling with exceptions disabled (fmtlib#3418, fmtlib#3439). Thanks @BRevzin.

  • Made format_as and std::filesystem::path formatter work with exotic code unit types. (fmtlib#3457, fmtlib#3476). Thanks @gix and @hmbj.

  • Added support for the ? format specifier to std::filesystem::path and made the default unescaped for consistency with strings.

  • Deprecated the wide stream overload of printf.

  • Removed unused basic_printf_parse_context.

  • Improved RTTI detection used when formatting exceptions (fmtlib#3468). Thanks @danakj.

  • Improved compatibility with VxWorks7 (fmtlib#3467). Thanks @wenshan1.

  • Improved documentation (fmtlib#3174, fmtlib#3423, fmtlib#3454, fmtlib#3458, fmtlib#3461, fmtlib#3487, fmtlib#3515). Thanks @zencatalyst, @rlalik and @mikecrowe.

  • Improved build and CI configurations (fmtlib#3449, fmtlib#3451, fmtlib#3452, fmtlib#3453, fmtlib#3459, fmtlib#3481, fmtlib#3486, fmtlib#3489, fmtlib#3496, fmtlib#3517, fmtlib#3523, fmtlib#3563). Thanks @joycebrum, @glebm, @phprus, @petrmanek, @setoye and @abouvier.

  • Fixed various warnings and compilation issues (fmtlib#3408, fmtlib#3424, fmtlib#3444, fmtlib#3446, fmtlib#3475, fmtlib#3482, fmtlib#3492, fmtlib#3493, fmtlib#3508, fmtlib#3509, fmtlib#3533, fmtlib#3542, fmtlib#3543, fmtlib#3540, fmtlib#3544, fmtlib#3548, fmtlib#3549, fmtlib#3550, fmtlib#3552). Thanks @adesitter, @hmbj, @Minty-Meeo, @phprus, @TobiSchluter, @kieranclancy, @alexeedm, @jurihock, @Ozomahtli and @razaqq.

10.0.0 - 2023-05-09

9.1.0 - 2022-08-27

9.0.0 - 2022-07-04

8.1.1 - 2022-01-06

8.1.0 - 2022-01-02

8.0.1 - 2021-07-02

8.0.0 - 2021-06-21

The change log for versions 0.8.0 - 7.1.3 is available here.