Skip to content

11.1.0

Compare
Choose a tag to compare
@vitaut vitaut released this 25 Dec 17:03
  • Improved C++20 module support (#4081, #4083, #4084, #4152, #4153, #4169, #4190, #4234, #4239). Thanks @kamrann and @Arghnews.

  • Reduced debug (unoptimized) binary code size and the number of template instantiations when passing formatting arguments. For example, unoptimized binary code size for fmt::print("{}", 42) was reduced by ~40% on GCC and ~60% on clang (x86-64).

    GCC:

    • Before: 161 instructions of which 105 are in reusable functions (godbolt).
    • After: 116 instructions of which 60 are in reusable functions (godbolt).

    Clang:

    • Before: 310 instructions of which 251 are in reusable functions (godbolt).
    • After: 194 instructions of which 135 are in reusable functions (godbolt).
  • Added an experimental fmt::writer API that can be used for writing to different destinations such as files or strings (#2354). For example (godbolt):

    #include <fmt/os.h>
    
    void write_text(fmt::writer w) {
      w.print("The answer is {}.", 42);
    }
    
    int main() {
      // Write to FILE.
      write_text(stdout);
    
      // Write to fmt::ostream.
      auto f = fmt::output_file("myfile");
      write_text(f);
    
      // Write to std::string.
      auto sb = fmt::string_buffer();
      write_text(sb);
      std::string s = sb.str();
    }
  • Added width and alignment support to the formatter of std::error_code.

  • Made std::expected<void, E> formattable (#4145, #4148). For example (godbolt):

    fmt::print("{}", std::expected<void, int>());

    prints

    expected()
    

    Thanks @phprus.

  • Made fmt::is_formattable<void> SFINAE-friendly (#4147).

  • Added support for _BitInt formatting when using clang (#4007, #4072, #4140, #4173, #4176). For example (godbolt):

    using int42 = _BitInt(42);
    fmt::print("{}", int42(100));

    Thanks @Arghnews.

  • Added the n specifier for tuples and pairs (#4107). Thanks @someonewithpc.

  • Added support for tuple-like types to fmt::join (#4226, #4230). Thanks @phprus.

  • Made more types formattable at compile time (#4127). Thanks @AnthonyVH.

  • Implemented a more efficient compile-time fmt::formatted_size (#4102, #4103). Thanks @phprus.

  • Fixed compile-time formatting of some string types (#4065). Thanks @torshepherd.

  • Made compiled version of fmt::format_to work with std::back_insert_iterator<std::vector<char>> (#4206, #4211). Thanks @phprus.

  • Added a formatter for std::reference_wrapper (#4163, #4164). Thanks @yfeldblum and @phprus.

  • Added experimental padding support (glibc strftime extension) to %m, %j and %Y (#4161). Thanks @KKhanhH.

  • Made microseconds formatted as us instead of µs if the Unicode support is disabled (#4088).

  • Fixed an unreleased regression in transcoding of surrogate pairs (#4094, #4095). Thanks @phprus.

  • Made fmt::appender satisfy std::output_iterator concept (#4092, #4093). Thanks @phprus.

  • Made std::iterator_traits<fmt::appender> standard-conforming (#4185). Thanks @CaseyCarter.

  • Made it easier to reuse fmt::formatter<std::string_view> for types with an implicit conversion to std::string_view (#4036, #4055). Thanks @Arghnews.

  • Made it possible to disable <filesystem> use via FMT_CPP_LIB_FILESYSTEM for compatibility with some video game console SDKs, e.g. Nintendo Switch SDK (#4257, #4258, #4259). Thanks @W4RH4WK and @phprus.

  • Fixed compatibility with platforms that use 80-bit long double (#4245, #4246). Thanks @jsirpoma.

  • Added support for UTF-32 code units greater than 0xFFFF in fill (#4201).

  • Fixed handling of legacy encodings on Windows with GCC (#4162).

  • Made fmt::to_string take fmt::basic_memory_buffer by const reference (#4261, #4262). Thanks @sascha-devel.

  • Added fmt::dynamic_format_arg_store::size (#4270). Thanks @hannes-harnisch.

  • Removed the ability to control locale usage via an undocumented FMT_STATIC_THOUSANDS_SEPARATOR in favor of FMT_USE_LOCALE.

  • Renamed FMT_EXCEPTIONS to FMT_USE_EXCEPTIONS for consistency with other similar macros.

  • Improved include directory ordering to reduce the chance of including incorrect headers when using multiple versions of {fmt} (#4116). Thanks @cdzhan.

  • Made it possible to compile a subset of {fmt} without the C++ runtime.

  • Improved documentation and README (#4066, #4117, #4203, #4235). Thanks @zyctree and @nikola-sh.

  • Improved the documentation generator (#4110, #4115). Thanks @rturrado.

  • Improved CI (#4155, #4151). Thanks @phprus.

  • Fixed various warnings and compilation issues (#2708, #4091, #4109, #4113, #4125, #4129, #4130, #4131, #4132, #4133, #4144, #4150, #4158, #4159, #4160, #4170, #4177, #4187, #4188, #4194, #4200, #4205, #4207, #4208, #4210, #4220, #4231, #4232, #4233, #4236, #4267, #4271). Thanks @torsten48, @Arghnews, @tinfoilboy, @aminya, @Ottani, @zeroomega, @c4v4, @kongy, @vinayyadav3016, @sergio-nsk, @phprus and @YexuanXiao.