1# 11.1.0 - TBD 2 3- Improved debug codegen. 4 5# 11.0.2 - 2024-07-20 6 7- Fixed compatibility with non-POSIX systems 8 (https://github.com/fmtlib/fmt/issues/4054, 9 https://github.com/fmtlib/fmt/issues/4060). 10 11- Fixed performance regressions when using `std::back_insert_iterator` with 12 `fmt::format_to` (https://github.com/fmtlib/fmt/issues/4070). 13 14- Fixed handling of `std::generator` and move-only iterators 15 (https://github.com/fmtlib/fmt/issues/4053, 16 https://github.com/fmtlib/fmt/pull/4057). Thanks @Arghnews. 17 18- Made `formatter<std::string_view>::parse` work with types convertible to 19 `std::string_view` (https://github.com/fmtlib/fmt/issues/4036, 20 https://github.com/fmtlib/fmt/pull/4055). Thanks @Arghnews. 21 22- Made `volatile void*` formattable 23 (https://github.com/fmtlib/fmt/issues/4049, 24 https://github.com/fmtlib/fmt/pull/4056). Thanks @Arghnews. 25 26- Made `Glib::ustring` not be confused with `std::string` 27 (https://github.com/fmtlib/fmt/issues/4052). 28 29- Made `fmt::context` iterator compatible with STL algorithms that rely on 30 iterator category (https://github.com/fmtlib/fmt/issues/4079). 31 32# 11.0.1 - 2024-07-05 33 34- Fixed version number in the inline namespace 35 (https://github.com/fmtlib/fmt/issues/4047). 36 37- Fixed disabling Unicode support via CMake 38 (https://github.com/fmtlib/fmt/issues/4051). 39 40- Fixed deprecated `visit_format_arg` (https://github.com/fmtlib/fmt/pull/4043). 41 Thanks @nebkat. 42 43- Fixed handling of a sign and improved the `std::complex` formater 44 (https://github.com/fmtlib/fmt/pull/4034, 45 https://github.com/fmtlib/fmt/pull/4050). Thanks @tesch1 and @phprus. 46 47- Fixed ADL issues in `fmt::printf` when using C++20 48 (https://github.com/fmtlib/fmt/pull/4042). Thanks @toge. 49 50- Removed a redundant check in the formatter for `std::expected` 51 (https://github.com/fmtlib/fmt/pull/4040). Thanks @phprus. 52 53# 11.0.0 - 2024-07-01 54 55- Added `fmt/base.h` which provides a subset of the API with minimal include 56 dependencies and enough functionality to replace all uses of the `printf` 57 family of functions. This brings the compile time of code using {fmt} much 58 closer to the equivalent `printf` code as shown on the following benchmark 59 that compiles 100 source files: 60 61 | Method | Compile Time (s) | 62 |--------------|------------------| 63 | printf | 1.6 | 64 | IOStreams | 25.9 | 65 | fmt 10.x | 19.0 | 66 | fmt 11.0 | 4.8 | 67 | tinyformat | 29.1 | 68 | Boost Format | 55.0 | 69 70 This gives almost 4x improvement in build speed compared to version 10. 71 Note that the benchmark is purely formatting code and includes. In real 72 projects the difference from `printf` will be smaller partly because common 73 standard headers will be included in almost any translation unit (TU) anyway. 74 In particular, in every case except `printf` above ~1s is spent in total on 75 including `<type_traits>` in all TUs. 76 77- Optimized includes in other headers such as `fmt/format.h` which is now 78 roughly equivalent to the old `fmt/core.h` in terms of build speed. 79 80- Migrated the documentation at https://fmt.dev/ from Sphinx to MkDocs. 81 82- Improved C++20 module support 83 (https://github.com/fmtlib/fmt/issues/3990, 84 https://github.com/fmtlib/fmt/pull/3991, 85 https://github.com/fmtlib/fmt/issues/3993, 86 https://github.com/fmtlib/fmt/pull/3994, 87 https://github.com/fmtlib/fmt/pull/3997, 88 https://github.com/fmtlib/fmt/pull/3998, 89 https://github.com/fmtlib/fmt/pull/4004, 90 https://github.com/fmtlib/fmt/pull/4005, 91 https://github.com/fmtlib/fmt/pull/4006, 92 https://github.com/fmtlib/fmt/pull/4013, 93 https://github.com/fmtlib/fmt/pull/4027, 94 https://github.com/fmtlib/fmt/pull/4029). In particular, native CMake support 95 for modules is now used if available. Thanks @yujincheng08 and @matt77hias. 96 97- Added an option to replace standard includes with `import std` enabled via 98 the `FMT_IMPORT_STD` macro (https://github.com/fmtlib/fmt/issues/3921, 99 https://github.com/fmtlib/fmt/pull/3928). Thanks @matt77hias. 100 101- Exported `fmt::range_format`, `fmt::range_format_kind` and 102 `fmt::compiled_string` from the `fmt` module 103 (https://github.com/fmtlib/fmt/pull/3970, 104 https://github.com/fmtlib/fmt/pull/3999). 105 Thanks @matt77hias and @yujincheng08. 106 107- Improved integration with stdio in `fmt::print`, enabling direct writes 108 into a C stream buffer in common cases. This may give significant 109 performance improvements ranging from tens of percent to [2x]( 110 https://stackoverflow.com/a/78457454/471164) and eliminates dynamic memory 111 allocations on the buffer level. It is currently enabled for built-in and 112 string types with wider availability coming up in future releases. 113 114 For example, it gives ~24% improvement on a [simple benchmark]( 115 https://isocpp.org/files/papers/P3107R5.html#perf) compiled with Apple clang 116 version 15.0.0 (clang-1500.1.0.2.5) and run on macOS 14.2.1: 117 118 ``` 119 ------------------------------------------------------- 120 Benchmark Time CPU Iterations 121 ------------------------------------------------------- 122 printf 81.8 ns 81.5 ns 8496899 123 fmt::print (10.x) 63.8 ns 61.9 ns 11524151 124 fmt::print (11.0) 51.3 ns 51.0 ns 13846580 125 ``` 126 127- Improved safety of `fmt::format_to` when writing to an array 128 (https://github.com/fmtlib/fmt/pull/3805). 129 For example ([godbolt](https://www.godbolt.org/z/cYrn8dWY8)): 130 131 ```c++ 132 auto volkswagen = char[4]; 133 auto result = fmt::format_to(volkswagen, "elephant"); 134 ``` 135 136 no longer results in a buffer overflow. Instead the output will be truncated 137 and you can get the end iterator and whether truncation occurred from the 138 `result` object. Thanks @ThePhD. 139 140- Enabled Unicode support by default in MSVC, bringing it on par with other 141 compilers and making it unnecessary for users to enable it explicitly. 142 Most of {fmt} is encoding-agnostic but this prevents mojibake in places 143 where encoding matters such as path formatting and terminal output. 144 You can control the Unicode support via the CMake `FMT_UNICODE` option. 145 Note that some {fmt} packages such as the one in vcpkg have already been 146 compiled with Unicode enabled. 147 148- Added a formatter for `std::expected` 149 (https://github.com/fmtlib/fmt/pull/3834). Thanks @dominicpoeschko. 150 151- Added a formatter for `std::complex` 152 (https://github.com/fmtlib/fmt/issues/1467, 153 https://github.com/fmtlib/fmt/issues/3886, 154 https://github.com/fmtlib/fmt/pull/3892, 155 https://github.com/fmtlib/fmt/pull/3900). Thanks @phprus. 156 157- Added a formatter for `std::type_info` 158 (https://github.com/fmtlib/fmt/pull/3978). Thanks @matt77hias. 159 160- Specialized `formatter` for `std::basic_string` types with custom traits 161 and allocators (https://github.com/fmtlib/fmt/issues/3938, 162 https://github.com/fmtlib/fmt/pull/3943). Thanks @dieram3. 163 164- Added formatters for `std::chrono::day`, `std::chrono::month`, 165 `std::chrono::year` and `std::chrono::year_month_day` 166 (https://github.com/fmtlib/fmt/issues/3758, 167 https://github.com/fmtlib/fmt/issues/3772, 168 https://github.com/fmtlib/fmt/pull/3906, 169 https://github.com/fmtlib/fmt/pull/3913). For example: 170 171 ```c++ 172 #include <fmt/chrono.h> 173 #include <fmt/color.h> 174 175 int main() { 176 fmt::print(fg(fmt::color::green), "{}\n", std::chrono::day(7)); 177 } 178 ``` 179 180 prints a green day: 181 182 <img width="306" alt="image" src="https://github.com/fmtlib/fmt/assets/576385/6e395f8b-451a-4cf7-bccc-ee92ca0dec65"> 183 184 Thanks @zivshek. 185 186- Fixed handling of precision in `%S` (https://github.com/fmtlib/fmt/issues/3794, 187 https://github.com/fmtlib/fmt/pull/3814). Thanks @js324. 188 189- Added support for the `-` specifier (glibc `strftime` extension) to day of 190 the month (`%d`) and week of the year (`%W`, `%U`, `%V`) specifiers 191 (https://github.com/fmtlib/fmt/pull/3976). Thanks @ZaheenJ. 192 193- Fixed the scope of the `-` extension in chrono formatting so that it doesn't 194 apply to subsequent specifiers (https://github.com/fmtlib/fmt/issues/3811, 195 https://github.com/fmtlib/fmt/pull/3812). Thanks @phprus. 196 197- Improved handling of `time_point::min()` 198 (https://github.com/fmtlib/fmt/issues/3282). 199 200- Added support for character range formatting 201 (https://github.com/fmtlib/fmt/issues/3857, 202 https://github.com/fmtlib/fmt/pull/3863). Thanks @js324. 203 204- Added `string` and `debug_string` range formatters 205 (https://github.com/fmtlib/fmt/pull/3973, 206 https://github.com/fmtlib/fmt/pull/4024). Thanks @matt77hias. 207 208- Enabled ADL for `begin` and `end` in `fmt::join` 209 (https://github.com/fmtlib/fmt/issues/3813, 210 https://github.com/fmtlib/fmt/pull/3824). Thanks @bbolli. 211 212- Made contiguous iterator optimizations apply to `std::basic_string` iterators 213 (https://github.com/fmtlib/fmt/pull/3798). Thanks @phprus. 214 215- Added support for ranges with mutable `begin` and `end` 216 (https://github.com/fmtlib/fmt/issues/3752, 217 https://github.com/fmtlib/fmt/pull/3800, 218 https://github.com/fmtlib/fmt/pull/3955). Thanks @tcbrindle and @Arghnews. 219 220- Added support for move-only iterators to `fmt::join` 221 (https://github.com/fmtlib/fmt/issues/3802, 222 https://github.com/fmtlib/fmt/pull/3946). Thanks @Arghnews. 223 224- Moved range and iterator overloads of `fmt::join` to `fmt/ranges.h`, next 225 to other overloads. 226 227- Fixed handling of types with `begin` returning `void` such as Eigen matrices 228 (https://github.com/fmtlib/fmt/issues/3839, 229 https://github.com/fmtlib/fmt/pull/3964). Thanks @Arghnews. 230 231- Added an `fmt::formattable` concept (https://github.com/fmtlib/fmt/pull/3974). 232 Thanks @matt77hias. 233 234- Added support for `__float128` (https://github.com/fmtlib/fmt/issues/3494). 235 236- Fixed rounding issues when formatting `long double` with fixed precision 237 (https://github.com/fmtlib/fmt/issues/3539). 238 239- Made `fmt::isnan` not trigger floating-point exception for NaN values 240 (https://github.com/fmtlib/fmt/issues/3948, 241 https://github.com/fmtlib/fmt/pull/3951). Thanks @alexdewar. 242 243- Removed dependency on `<memory>` for `std::allocator_traits` when possible 244 (https://github.com/fmtlib/fmt/pull/3804). Thanks @phprus. 245 246- Enabled compile-time checks in formatting functions that take text colors and 247 styles. 248 249- Deprecated wide stream overloads of `fmt::print` that take text styles. 250 251- Made format string compilation work with clang 12 and later despite 252 only partial non-type template parameter support 253 (https://github.com/fmtlib/fmt/issues/4000, 254 https://github.com/fmtlib/fmt/pull/4001). Thanks @yujincheng08. 255 256- Made `fmt::iterator_buffer`'s move constructor `noexcept` 257 (https://github.com/fmtlib/fmt/pull/3808). Thanks @waywardmonkeys. 258 259- Started enforcing that `formatter::format` is const for compatibility 260 with `std::format` (https://github.com/fmtlib/fmt/issues/3447). 261 262- Added `fmt::basic_format_arg::visit` and deprecated `fmt::visit_format_arg`. 263 264- Made `fmt::basic_string_view` not constructible from `nullptr` for 265 consistency with `std::string_view` in C++23 266 (https://github.com/fmtlib/fmt/pull/3846). Thanks @dalle. 267 268- Fixed `fmt::group_digits` for negative integers 269 (https://github.com/fmtlib/fmt/issues/3891, 270 https://github.com/fmtlib/fmt/pull/3901). Thanks @phprus. 271 272- Fixed handling of negative ids in `fmt::basic_format_args::get` 273 (https://github.com/fmtlib/fmt/pull/3945). Thanks @marlenecota. 274 275- Improved named argument validation 276 (https://github.com/fmtlib/fmt/issues/3817). 277 278- Disabled copy construction/assignment for `fmt::format_arg_store` and 279 fixed moved construction (https://github.com/fmtlib/fmt/pull/3833). 280 Thanks @ivafanas. 281 282- Worked around a locale issue in RHEL/devtoolset 283 (https://github.com/fmtlib/fmt/issues/3858, 284 https://github.com/fmtlib/fmt/pull/3859). Thanks @g199209. 285 286- Added RTTI detection for MSVC (https://github.com/fmtlib/fmt/pull/3821, 287 https://github.com/fmtlib/fmt/pull/3963). Thanks @edo9300. 288 289- Migrated the documentation from Sphinx to MkDocs. 290 291- Improved documentation and README 292 (https://github.com/fmtlib/fmt/issues/3775, 293 https://github.com/fmtlib/fmt/pull/3784, 294 https://github.com/fmtlib/fmt/issues/3788, 295 https://github.com/fmtlib/fmt/pull/3789, 296 https://github.com/fmtlib/fmt/pull/3793, 297 https://github.com/fmtlib/fmt/issues/3818, 298 https://github.com/fmtlib/fmt/pull/3820, 299 https://github.com/fmtlib/fmt/pull/3822, 300 https://github.com/fmtlib/fmt/pull/3843, 301 https://github.com/fmtlib/fmt/pull/3890, 302 https://github.com/fmtlib/fmt/issues/3894, 303 https://github.com/fmtlib/fmt/pull/3895, 304 https://github.com/fmtlib/fmt/pull/3905, 305 https://github.com/fmtlib/fmt/issues/3942, 306 https://github.com/fmtlib/fmt/pull/4008). 307 Thanks @zencatalyst, WolleTD, @tupaschoal, @Dobiasd, @frank-weinberg, @bbolli, 308 @phprus, @waywardmonkeys, @js324 and @tchaikov. 309 310- Improved CI and tests 311 (https://github.com/fmtlib/fmt/issues/3878, 312 https://github.com/fmtlib/fmt/pull/3883, 313 https://github.com/fmtlib/fmt/issues/3897, 314 https://github.com/fmtlib/fmt/pull/3979, 315 https://github.com/fmtlib/fmt/pull/3980, 316 https://github.com/fmtlib/fmt/pull/3988, 317 https://github.com/fmtlib/fmt/pull/4010, 318 https://github.com/fmtlib/fmt/pull/4012, 319 https://github.com/fmtlib/fmt/pull/4038). 320 Thanks @vgorrX, @waywardmonkeys, @tchaikov and @phprus. 321 322- Fixed buffer overflow when using format string compilation with debug format 323 and `std::back_insert_iterator` (https://github.com/fmtlib/fmt/issues/3795, 324 https://github.com/fmtlib/fmt/pull/3797). Thanks @phprus. 325 326- Improved Bazel support 327 (https://github.com/fmtlib/fmt/pull/3792, 328 https://github.com/fmtlib/fmt/pull/3801, 329 https://github.com/fmtlib/fmt/pull/3962, 330 https://github.com/fmtlib/fmt/pull/3965). Thanks @Vertexwahn. 331 332- Improved/fixed the CMake config 333 (https://github.com/fmtlib/fmt/issues/3777, 334 https://github.com/fmtlib/fmt/pull/3783, 335 https://github.com/fmtlib/fmt/issues/3847, 336 https://github.com/fmtlib/fmt/pull/3907). Thanks @phprus and @xTachyon. 337 338- Fixed various warnings and compilation issues 339 (https://github.com/fmtlib/fmt/issues/3685, 340 https://github.com/fmtlib/fmt/issues/3769, 341 https://github.com/fmtlib/fmt/issues/3796, 342 https://github.com/fmtlib/fmt/issues/3803, 343 https://github.com/fmtlib/fmt/pull/3806, 344 https://github.com/fmtlib/fmt/pull/3807, 345 https://github.com/fmtlib/fmt/issues/3809, 346 https://github.com/fmtlib/fmt/pull/3810, 347 https://github.com/fmtlib/fmt/issues/3830, 348 https://github.com/fmtlib/fmt/pull/3832, 349 https://github.com/fmtlib/fmt/issues/3835, 350 https://github.com/fmtlib/fmt/pull/3844, 351 https://github.com/fmtlib/fmt/issues/3854, 352 https://github.com/fmtlib/fmt/pull/3856, 353 https://github.com/fmtlib/fmt/pull/3865, 354 https://github.com/fmtlib/fmt/pull/3866, 355 https://github.com/fmtlib/fmt/pull/3880, 356 https://github.com/fmtlib/fmt/issues/3881, 357 https://github.com/fmtlib/fmt/issues/3884, 358 https://github.com/fmtlib/fmt/issues/3898, 359 https://github.com/fmtlib/fmt/pull/3899, 360 https://github.com/fmtlib/fmt/pull/3909, 361 https://github.com/fmtlib/fmt/pull/3917, 362 https://github.com/fmtlib/fmt/pull/3923, 363 https://github.com/fmtlib/fmt/pull/3924, 364 https://github.com/fmtlib/fmt/issues/3925, 365 https://github.com/fmtlib/fmt/pull/3930, 366 https://github.com/fmtlib/fmt/pull/3931, 367 https://github.com/fmtlib/fmt/pull/3933, 368 https://github.com/fmtlib/fmt/issues/3935, 369 https://github.com/fmtlib/fmt/pull/3937, 370 https://github.com/fmtlib/fmt/pull/3967, 371 https://github.com/fmtlib/fmt/pull/3968, 372 https://github.com/fmtlib/fmt/pull/3972, 373 https://github.com/fmtlib/fmt/pull/3983, 374 https://github.com/fmtlib/fmt/issues/3992, 375 https://github.com/fmtlib/fmt/pull/3995, 376 https://github.com/fmtlib/fmt/pull/4009, 377 https://github.com/fmtlib/fmt/pull/4023). 378 Thanks @hmbj, @phprus, @res2k, @Baardi, @matt77hias, @waywardmonkeys, @hmbj, 379 @yakra, @prlw1, @Arghnews, @mtillmann0, @ShifftC, @eepp, @jimmy-park and 380 @ChristianGebhardt. 381 382# 10.2.1 - 2024-01-04 383 384- Fixed ABI compatibility with earlier 10.x versions 385 (https://github.com/fmtlib/fmt/issues/3785, 386 https://github.com/fmtlib/fmt/pull/3786). Thanks @saraedum. 387 388# 10.2.0 - 2024-01-01 389 390- Added support for the `%j` specifier (the number of days) for 391 `std::chrono::duration` (https://github.com/fmtlib/fmt/issues/3643, 392 https://github.com/fmtlib/fmt/pull/3732). Thanks @intelfx. 393 394- Added support for the chrono suffix for days and changed 395 the suffix for minutes from "m" to the correct "min" 396 (https://github.com/fmtlib/fmt/issues/3662, 397 https://github.com/fmtlib/fmt/pull/3664). 398 For example ([godbolt](https://godbolt.org/z/9KhMnq9ba)): 399 400 ```c++ 401 #include <fmt/chrono.h> 402 403 int main() { 404 fmt::print("{}\n", std::chrono::days(42)); // prints "42d" 405 } 406 ``` 407 408 Thanks @Richardk2n. 409 410- Fixed an overflow in `std::chrono::time_point` formatting with large dates 411 (https://github.com/fmtlib/fmt/issues/3725, 412 https://github.com/fmtlib/fmt/pull/3727). Thanks @cschreib. 413 414- Added a formatter for `std::source_location` 415 (https://github.com/fmtlib/fmt/pull/3730). 416 For example ([godbolt](https://godbolt.org/z/YajfKjhhr)): 417 418 ```c++ 419 #include <source_location> 420 #include <fmt/std.h> 421 422 int main() { 423 fmt::print("{}\n", std::source_location::current()); 424 } 425 ``` 426 427 prints 428 429 ``` 430 /app/example.cpp:5:51: int main() 431 ``` 432 433 Thanks @felix642. 434 435- Added a formatter for `std::bitset` 436 (https://github.com/fmtlib/fmt/pull/3660). 437 For example ([godbolt](https://godbolt.org/z/bdEaGeYxe)): 438 439 ```c++ 440 #include <bitset> 441 #include <fmt/std.h> 442 443 int main() { 444 fmt::print("{}\n", std::bitset<6>(42)); // prints "101010" 445 } 446 ``` 447 448 Thanks @muggenhor. 449 450- Added an experimental `nested_formatter` that provides an easy way of 451 applying a formatter to one or more subobjects while automatically handling 452 width, fill and alignment. For example: 453 454 ```c++ 455 #include <fmt/format.h> 456 457 struct point { 458 double x, y; 459 }; 460 461 template <> 462 struct fmt::formatter<point> : nested_formatter<double> { 463 auto format(point p, format_context& ctx) const { 464 return write_padded(ctx, [=](auto out) { 465 return format_to(out, "({}, {})", nested(p.x), nested(p.y)); 466 }); 467 } 468 }; 469 470 int main() { 471 fmt::print("[{:>20.2f}]", point{1, 2}); 472 } 473 ``` 474 475 prints 476 477 ``` 478 [ (1.00, 2.00)] 479 ``` 480 481- Added the generic representation (`g`) to `std::filesystem::path` 482 (https://github.com/fmtlib/fmt/issues/3715, 483 https://github.com/fmtlib/fmt/pull/3729). For example: 484 485 ```c++ 486 #include <filesystem> 487 #include <fmt/std.h> 488 489 int main() { 490 fmt::print("{:g}\n", std::filesystem::path("C:\\foo")); 491 } 492 ``` 493 494 prints `"C:/foo"` on Windows. 495 496 Thanks @js324. 497 498- Made `format_as` work with references 499 (https://github.com/fmtlib/fmt/pull/3739). Thanks @tchaikov. 500 501- Fixed formatting of invalid UTF-8 with precision 502 (https://github.com/fmtlib/fmt/issues/3284). 503 504- Fixed an inconsistency between `fmt::to_string` and `fmt::format` 505 (https://github.com/fmtlib/fmt/issues/3684). 506 507- Disallowed unsafe uses of `fmt::styled` 508 (https://github.com/fmtlib/fmt/issues/3625): 509 510 ```c++ 511 auto s = fmt::styled(std::string("dangle"), fmt::emphasis::bold); 512 fmt::print("{}\n", s); // compile error 513 ``` 514 515 Pass `fmt::styled(...)` as a parameter instead. 516 517- Added a null check when formatting a C string with the `s` specifier 518 (https://github.com/fmtlib/fmt/issues/3706). 519 520- Disallowed the `c` specifier for `bool` 521 (https://github.com/fmtlib/fmt/issues/3726, 522 https://github.com/fmtlib/fmt/pull/3734). Thanks @js324. 523 524- Made the default formatting unlocalized in `fmt::ostream_formatter` for 525 consistency with the rest of the library 526 (https://github.com/fmtlib/fmt/issues/3460). 527 528- Fixed localized formatting in bases other than decimal 529 (https://github.com/fmtlib/fmt/issues/3693, 530 https://github.com/fmtlib/fmt/pull/3750). Thanks @js324. 531 532- Fixed a performance regression in experimental `fmt::ostream::print` 533 (https://github.com/fmtlib/fmt/issues/3674). 534 535- Added synchronization with the underlying output stream when writing to 536 the Windows console 537 (https://github.com/fmtlib/fmt/pull/3668, 538 https://github.com/fmtlib/fmt/issues/3688, 539 https://github.com/fmtlib/fmt/pull/3689). 540 Thanks @Roman-Koshelev and @dimztimz. 541 542- Changed to only export `format_error` when {fmt} is built as a shared 543 library (https://github.com/fmtlib/fmt/issues/3626, 544 https://github.com/fmtlib/fmt/pull/3627). Thanks @phprus. 545 546- Made `fmt::streamed` `constexpr`. 547 (https://github.com/fmtlib/fmt/pull/3650). Thanks @muggenhor. 548 549- Made `fmt::format_int` `constexpr` 550 (https://github.com/fmtlib/fmt/issues/4031, 551 https://github.com/fmtlib/fmt/pull/4032). Thanks @dixlorenz. 552 553- Enabled `consteval` on older versions of MSVC 554 (https://github.com/fmtlib/fmt/pull/3757). Thanks @phprus. 555 556- Added an option to build without `wchar_t` support on Windows 557 (https://github.com/fmtlib/fmt/issues/3631, 558 https://github.com/fmtlib/fmt/pull/3636). Thanks @glebm. 559 560- Improved build and CI configuration 561 (https://github.com/fmtlib/fmt/pull/3679, 562 https://github.com/fmtlib/fmt/issues/3701, 563 https://github.com/fmtlib/fmt/pull/3702, 564 https://github.com/fmtlib/fmt/pull/3749). 565 Thanks @jcar87, @pklima and @tchaikov. 566 567- Fixed various warnings, compilation and test issues 568 (https://github.com/fmtlib/fmt/issues/3607, 569 https://github.com/fmtlib/fmt/pull/3610, 570 https://github.com/fmtlib/fmt/pull/3624, 571 https://github.com/fmtlib/fmt/pull/3630, 572 https://github.com/fmtlib/fmt/pull/3634, 573 https://github.com/fmtlib/fmt/pull/3638, 574 https://github.com/fmtlib/fmt/issues/3645, 575 https://github.com/fmtlib/fmt/issues/3646, 576 https://github.com/fmtlib/fmt/pull/3647, 577 https://github.com/fmtlib/fmt/pull/3652, 578 https://github.com/fmtlib/fmt/issues/3654, 579 https://github.com/fmtlib/fmt/pull/3663, 580 https://github.com/fmtlib/fmt/issues/3670, 581 https://github.com/fmtlib/fmt/pull/3680, 582 https://github.com/fmtlib/fmt/issues/3694, 583 https://github.com/fmtlib/fmt/pull/3695, 584 https://github.com/fmtlib/fmt/pull/3699, 585 https://github.com/fmtlib/fmt/issues/3705, 586 https://github.com/fmtlib/fmt/issues/3710, 587 https://github.com/fmtlib/fmt/issues/3712, 588 https://github.com/fmtlib/fmt/pull/3713, 589 https://github.com/fmtlib/fmt/issues/3714, 590 https://github.com/fmtlib/fmt/pull/3716, 591 https://github.com/fmtlib/fmt/pull/3723, 592 https://github.com/fmtlib/fmt/issues/3738, 593 https://github.com/fmtlib/fmt/issues/3740, 594 https://github.com/fmtlib/fmt/pull/3741, 595 https://github.com/fmtlib/fmt/pull/3743, 596 https://github.com/fmtlib/fmt/issues/3745, 597 https://github.com/fmtlib/fmt/pull/3747, 598 https://github.com/fmtlib/fmt/pull/3748, 599 https://github.com/fmtlib/fmt/pull/3751, 600 https://github.com/fmtlib/fmt/pull/3754, 601 https://github.com/fmtlib/fmt/pull/3755, 602 https://github.com/fmtlib/fmt/issues/3760, 603 https://github.com/fmtlib/fmt/pull/3762, 604 https://github.com/fmtlib/fmt/issues/3763, 605 https://github.com/fmtlib/fmt/pull/3764, 606 https://github.com/fmtlib/fmt/issues/3774, 607 https://github.com/fmtlib/fmt/pull/3779). 608 Thanks @danakj, @vinayyadav3016, @cyyever, @phprus, @qimiko, @saschasc, 609 @gsjaardema, @lazka, @Zhaojun-Liu, @carlsmedstad, @hotwatermorning, 610 @cptFracassa, @kuguma, @PeterJohnson, @H1X4Dev, @asantoni, @eltociear, 611 @msimberg, @tchaikov, @waywardmonkeys. 612 613- Improved documentation and README 614 (https://github.com/fmtlib/fmt/issues/2086, 615 https://github.com/fmtlib/fmt/issues/3637, 616 https://github.com/fmtlib/fmt/pull/3642, 617 https://github.com/fmtlib/fmt/pull/3653, 618 https://github.com/fmtlib/fmt/pull/3655, 619 https://github.com/fmtlib/fmt/pull/3661, 620 https://github.com/fmtlib/fmt/issues/3673, 621 https://github.com/fmtlib/fmt/pull/3677, 622 https://github.com/fmtlib/fmt/pull/3737, 623 https://github.com/fmtlib/fmt/issues/3742, 624 https://github.com/fmtlib/fmt/pull/3744). 625 Thanks @idzm, @perlun, @joycebrum, @fennewald, @reinhardt1053, @GeorgeLS. 626 627- Updated CI dependencies 628 (https://github.com/fmtlib/fmt/pull/3615, 629 https://github.com/fmtlib/fmt/pull/3622, 630 https://github.com/fmtlib/fmt/pull/3623, 631 https://github.com/fmtlib/fmt/pull/3666, 632 https://github.com/fmtlib/fmt/pull/3696, 633 https://github.com/fmtlib/fmt/pull/3697, 634 https://github.com/fmtlib/fmt/pull/3759, 635 https://github.com/fmtlib/fmt/pull/3782). 636 637# 10.1.1 - 2023-08-28 638 639- Added formatters for `std::atomic` and `atomic_flag` 640 (https://github.com/fmtlib/fmt/pull/3574, 641 https://github.com/fmtlib/fmt/pull/3594). 642 Thanks @wangzw and @AlexGuteniev. 643- Fixed an error about partial specialization of `formatter<string>` 644 after instantiation when compiled with gcc and C++20 645 (https://github.com/fmtlib/fmt/issues/3584). 646- Fixed compilation as a C++20 module with gcc and clang 647 (https://github.com/fmtlib/fmt/issues/3587, 648 https://github.com/fmtlib/fmt/pull/3597, 649 https://github.com/fmtlib/fmt/pull/3605). 650 Thanks @MathewBensonCode. 651- Made `fmt::to_string` work with types that have `format_as` 652 overloads (https://github.com/fmtlib/fmt/pull/3575). Thanks @phprus. 653- Made `formatted_size` work with integral format specifiers at 654 compile time (https://github.com/fmtlib/fmt/pull/3591). 655 Thanks @elbeno. 656- Fixed a warning about the `no_unique_address` attribute on clang-cl 657 (https://github.com/fmtlib/fmt/pull/3599). Thanks @lukester1975. 658- Improved compatibility with the legacy GBK encoding 659 (https://github.com/fmtlib/fmt/issues/3598, 660 https://github.com/fmtlib/fmt/pull/3599). Thanks @YuHuanTin. 661- Added OpenSSF Scorecard analysis 662 (https://github.com/fmtlib/fmt/issues/3530, 663 https://github.com/fmtlib/fmt/pull/3571). Thanks @joycebrum. 664- Updated CI dependencies 665 (https://github.com/fmtlib/fmt/pull/3591, 666 https://github.com/fmtlib/fmt/pull/3592, 667 https://github.com/fmtlib/fmt/pull/3593, 668 https://github.com/fmtlib/fmt/pull/3602). 669 670# 10.1.0 - 2023-08-12 671 672- Optimized format string compilation resulting in up to 40% speed up 673 in compiled `format_to` and \~4x speed up in compiled `format_to_n` 674 on a concatenation benchmark 675 (https://github.com/fmtlib/fmt/issues/3133, 676 https://github.com/fmtlib/fmt/issues/3484). 677 678 {fmt} 10.0: 679 680 --------------------------------------------------------- 681 Benchmark Time CPU Iterations 682 --------------------------------------------------------- 683 BM_format_to 78.9 ns 78.9 ns 8881746 684 BM_format_to_n 568 ns 568 ns 1232089 685 686 {fmt} 10.1: 687 688 --------------------------------------------------------- 689 Benchmark Time CPU Iterations 690 --------------------------------------------------------- 691 BM_format_to 54.9 ns 54.9 ns 12727944 692 BM_format_to_n 133 ns 133 ns 5257795 693 694- Optimized storage of an empty allocator in `basic_memory_buffer` 695 (https://github.com/fmtlib/fmt/pull/3485). Thanks @Minty-Meeo. 696 697- Added formatters for proxy references to elements of 698 `std::vector<bool>` and `std::bitset<N>` 699 (https://github.com/fmtlib/fmt/issues/3567, 700 https://github.com/fmtlib/fmt/pull/3570). For example 701 ([godbolt](https://godbolt.org/z/zYb79Pvn8)): 702 703 ```c++ 704 #include <vector> 705 #include <fmt/std.h> 706 707 int main() { 708 auto v = std::vector<bool>{true}; 709 fmt::print("{}", v[0]); 710 } 711 ``` 712 713 Thanks @phprus and @felix642. 714 715- Fixed an ambiguous formatter specialization for containers that look 716 like container adaptors such as `boost::flat_set` 717 (https://github.com/fmtlib/fmt/issues/3556, 718 https://github.com/fmtlib/fmt/pull/3561). Thanks @5chmidti. 719 720- Fixed compilation when formatting durations not convertible from 721 `std::chrono::seconds` 722 (https://github.com/fmtlib/fmt/pull/3430). Thanks @patlkli. 723 724- Made the `formatter` specialization for `char*` const-correct 725 (https://github.com/fmtlib/fmt/pull/3432). Thanks @timsong-cpp. 726 727- Made `{}` and `{:}` handled consistently during compile-time checks 728 (https://github.com/fmtlib/fmt/issues/3526). 729 730- Disallowed passing temporaries to `make_format_args` to improve API 731 safety by preventing dangling references. 732 733- Improved the compile-time error for unformattable types 734 (https://github.com/fmtlib/fmt/pull/3478). Thanks @BRevzin. 735 736- Improved the floating-point formatter 737 (https://github.com/fmtlib/fmt/pull/3448, 738 https://github.com/fmtlib/fmt/pull/3450). 739 Thanks @florimond-collette. 740 741- Fixed handling of precision for `long double` larger than 64 bits. 742 (https://github.com/fmtlib/fmt/issues/3539, 743 https://github.com/fmtlib/fmt/issues/3564). 744 745- Made floating-point and chrono tests less platform-dependent 746 (https://github.com/fmtlib/fmt/issues/3337, 747 https://github.com/fmtlib/fmt/issues/3433, 748 https://github.com/fmtlib/fmt/pull/3434). Thanks @phprus. 749 750- Removed the remnants of the Grisu floating-point formatter that has 751 been replaced by Dragonbox in earlier versions. 752 753- Added `throw_format_error` to the public API 754 (https://github.com/fmtlib/fmt/pull/3551). Thanks @mjerabek. 755 756- Made `FMT_THROW` assert even if assertions are disabled when 757 compiling with exceptions disabled 758 (https://github.com/fmtlib/fmt/issues/3418, 759 https://github.com/fmtlib/fmt/pull/3439). Thanks @BRevzin. 760 761- Made `format_as` and `std::filesystem::path` formatter work with 762 exotic code unit types. 763 (https://github.com/fmtlib/fmt/pull/3457, 764 https://github.com/fmtlib/fmt/pull/3476). Thanks @gix and @hmbj. 765 766- Added support for the `?` format specifier to 767 `std::filesystem::path` and made the default unescaped for 768 consistency with strings. 769 770- Deprecated the wide stream overload of `printf`. 771 772- Removed unused `basic_printf_parse_context`. 773 774- Improved RTTI detection used when formatting exceptions 775 (https://github.com/fmtlib/fmt/pull/3468). Thanks @danakj. 776 777- Improved compatibility with VxWorks7 778 (https://github.com/fmtlib/fmt/pull/3467). Thanks @wenshan1. 779 780- Improved documentation 781 (https://github.com/fmtlib/fmt/issues/3174, 782 https://github.com/fmtlib/fmt/issues/3423, 783 https://github.com/fmtlib/fmt/pull/3454, 784 https://github.com/fmtlib/fmt/issues/3458, 785 https://github.com/fmtlib/fmt/pull/3461, 786 https://github.com/fmtlib/fmt/issues/3487, 787 https://github.com/fmtlib/fmt/pull/3515). 788 Thanks @zencatalyst, @rlalik and @mikecrowe. 789 790- Improved build and CI configurations 791 (https://github.com/fmtlib/fmt/issues/3449, 792 https://github.com/fmtlib/fmt/pull/3451, 793 https://github.com/fmtlib/fmt/pull/3452, 794 https://github.com/fmtlib/fmt/pull/3453, 795 https://github.com/fmtlib/fmt/pull/3459, 796 https://github.com/fmtlib/fmt/issues/3481, 797 https://github.com/fmtlib/fmt/pull/3486, 798 https://github.com/fmtlib/fmt/issues/3489, 799 https://github.com/fmtlib/fmt/pull/3496, 800 https://github.com/fmtlib/fmt/issues/3517, 801 https://github.com/fmtlib/fmt/pull/3523, 802 https://github.com/fmtlib/fmt/pull/3563). 803 Thanks @joycebrum, @glebm, @phprus, @petrmanek, @setoye and @abouvier. 804 805- Fixed various warnings and compilation issues 806 (https://github.com/fmtlib/fmt/issues/3408, 807 https://github.com/fmtlib/fmt/issues/3424, 808 https://github.com/fmtlib/fmt/issues/3444, 809 https://github.com/fmtlib/fmt/pull/3446, 810 https://github.com/fmtlib/fmt/pull/3475, 811 https://github.com/fmtlib/fmt/pull/3482, 812 https://github.com/fmtlib/fmt/issues/3492, 813 https://github.com/fmtlib/fmt/pull/3493, 814 https://github.com/fmtlib/fmt/pull/3508, 815 https://github.com/fmtlib/fmt/issues/3509, 816 https://github.com/fmtlib/fmt/issues/3533, 817 https://github.com/fmtlib/fmt/pull/3542, 818 https://github.com/fmtlib/fmt/issues/3543, 819 https://github.com/fmtlib/fmt/issues/3540, 820 https://github.com/fmtlib/fmt/pull/3544, 821 https://github.com/fmtlib/fmt/issues/3548, 822 https://github.com/fmtlib/fmt/pull/3549, 823 https://github.com/fmtlib/fmt/pull/3550, 824 https://github.com/fmtlib/fmt/pull/3552). 825 Thanks @adesitter, @hmbj, @Minty-Meeo, @phprus, @TobiSchluter, 826 @kieranclancy, @alexeedm, @jurihock, @Ozomahtli and @razaqq. 827 828# 10.0.0 - 2023-05-09 829 830- Replaced Grisu with a new floating-point formatting algorithm for 831 given precision (https://github.com/fmtlib/fmt/issues/3262, 832 https://github.com/fmtlib/fmt/issues/2750, 833 https://github.com/fmtlib/fmt/pull/3269, 834 https://github.com/fmtlib/fmt/pull/3276). The new algorithm 835 is based on Dragonbox already used for the shortest representation 836 and gives substantial performance improvement: 837 838  839 840 - Red: new algorithm 841 - Green: new algorithm with `FMT_USE_FULL_CACHE_DRAGONBOX` defined 842 to 1 843 - Blue: old algorithm 844 845 Thanks @jk-jeon. 846 847- Replaced `snprintf`-based hex float formatter with an internal 848 implementation (https://github.com/fmtlib/fmt/pull/3179, 849 https://github.com/fmtlib/fmt/pull/3203). This removes the 850 last usage of `s(n)printf` in {fmt}. Thanks @phprus. 851 852- Fixed alignment of floating-point numbers with localization 853 (https://github.com/fmtlib/fmt/issues/3263, 854 https://github.com/fmtlib/fmt/pull/3272). Thanks @ShawnZhong. 855 856- Made handling of `#` consistent with `std::format`. 857 858- Improved C++20 module support 859 (https://github.com/fmtlib/fmt/pull/3134, 860 https://github.com/fmtlib/fmt/pull/3254, 861 https://github.com/fmtlib/fmt/pull/3386, 862 https://github.com/fmtlib/fmt/pull/3387, 863 https://github.com/fmtlib/fmt/pull/3388, 864 https://github.com/fmtlib/fmt/pull/3392, 865 https://github.com/fmtlib/fmt/pull/3397, 866 https://github.com/fmtlib/fmt/pull/3399, 867 https://github.com/fmtlib/fmt/pull/3400). 868 Thanks @laitingsheng, @Orvid and @DanielaE. 869 870- Switched to the [modules CMake library](https://github.com/vitaut/modules) 871 which allows building {fmt} as a C++20 module with clang: 872 873 CXX=clang++ cmake -DFMT_MODULE=ON . 874 make 875 876- Made `format_as` work with any user-defined type and not just enums. 877 For example ([godbolt](https://godbolt.org/z/b7rqhq5Kh)): 878 879 ```c++ 880 #include <fmt/format.h> 881 882 struct floaty_mc_floatface { 883 double value; 884 }; 885 886 auto format_as(floaty_mc_floatface f) { return f.value; } 887 888 int main() { 889 fmt::print("{:8}\n", floaty_mc_floatface{0.42}); // prints " 0.42" 890 } 891 ``` 892 893- Removed deprecated implicit conversions for enums and conversions to 894 primitive types for compatibility with `std::format` and to prevent 895 potential ODR violations. Use `format_as` instead. 896 897- Added support for fill, align and width to the time point formatter 898 (https://github.com/fmtlib/fmt/issues/3237, 899 https://github.com/fmtlib/fmt/pull/3260, 900 https://github.com/fmtlib/fmt/pull/3275). For example 901 ([godbolt](https://godbolt.org/z/rKP6MGz6c)): 902 903 ```c++ 904 #include <fmt/chrono.h> 905 906 int main() { 907 // prints " 2023" 908 fmt::print("{:>8%Y}\n", std::chrono::system_clock::now()); 909 } 910 ``` 911 912 Thanks @ShawnZhong. 913 914- Implemented formatting of subseconds 915 (https://github.com/fmtlib/fmt/issues/2207, 916 https://github.com/fmtlib/fmt/issues/3117, 917 https://github.com/fmtlib/fmt/pull/3115, 918 https://github.com/fmtlib/fmt/pull/3143, 919 https://github.com/fmtlib/fmt/pull/3144, 920 https://github.com/fmtlib/fmt/pull/3349). For example 921 ([godbolt](https://godbolt.org/z/45738oGEo)): 922 923 ```c++ 924 #include <fmt/chrono.h> 925 926 int main() { 927 // prints 01.234567 928 fmt::print("{:%S}\n", std::chrono::microseconds(1234567)); 929 } 930 ``` 931 932 Thanks @patrickroocks @phprus and @BRevzin. 933 934- Added precision support to `%S` 935 (https://github.com/fmtlib/fmt/pull/3148). Thanks @SappyJoy 936 937- Added support for `std::utc_time` 938 (https://github.com/fmtlib/fmt/issues/3098, 939 https://github.com/fmtlib/fmt/pull/3110). Thanks @patrickroocks. 940 941- Switched formatting of `std::chrono::system_clock` from local time 942 to UTC for compatibility with the standard 943 (https://github.com/fmtlib/fmt/issues/3199, 944 https://github.com/fmtlib/fmt/pull/3230). Thanks @ned14. 945 946- Added support for `%Ez` and `%Oz` to chrono formatters. 947 (https://github.com/fmtlib/fmt/issues/3220, 948 https://github.com/fmtlib/fmt/pull/3222). Thanks @phprus. 949 950- Improved validation of format specifiers for `std::chrono::duration` 951 (https://github.com/fmtlib/fmt/issues/3219, 952 https://github.com/fmtlib/fmt/pull/3232). Thanks @ShawnZhong. 953 954- Fixed formatting of time points before the epoch 955 (https://github.com/fmtlib/fmt/issues/3117, 956 https://github.com/fmtlib/fmt/pull/3261). For example 957 ([godbolt](https://godbolt.org/z/f7bcznb3W)): 958 959 ```c++ 960 #include <fmt/chrono.h> 961 962 int main() { 963 auto t = std::chrono::system_clock::from_time_t(0) - 964 std::chrono::milliseconds(250); 965 fmt::print("{:%S}\n", t); // prints 59.750000000 966 } 967 ``` 968 969 Thanks @ShawnZhong. 970 971- Experimental: implemented glibc extension for padding seconds, 972 minutes and hours 973 (https://github.com/fmtlib/fmt/issues/2959, 974 https://github.com/fmtlib/fmt/pull/3271). Thanks @ShawnZhong. 975 976- Added a formatter for `std::exception` 977 (https://github.com/fmtlib/fmt/issues/2977, 978 https://github.com/fmtlib/fmt/issues/3012, 979 https://github.com/fmtlib/fmt/pull/3062, 980 https://github.com/fmtlib/fmt/pull/3076, 981 https://github.com/fmtlib/fmt/pull/3119). For example 982 ([godbolt](https://godbolt.org/z/8xoWGs9e4)): 983 984 ```c++ 985 #include <fmt/std.h> 986 #include <vector> 987 988 int main() { 989 try { 990 std::vector<bool>().at(0); 991 } catch(const std::exception& e) { 992 fmt::print("{}", e); 993 } 994 } 995 ``` 996 997 prints: 998 999 vector<bool>::_M_range_check: __n (which is 0) >= this->size() (which is 0) 1000 1001 on libstdc++. Thanks @zach2good and @phprus. 1002 1003- Moved `std::error_code` formatter from `fmt/os.h` to `fmt/std.h`. 1004 (https://github.com/fmtlib/fmt/pull/3125). Thanks @phprus. 1005 1006- Added formatters for standard container adapters: 1007 `std::priority_queue`, `std::queue` and `std::stack` 1008 (https://github.com/fmtlib/fmt/issues/3215, 1009 https://github.com/fmtlib/fmt/pull/3279). For example 1010 ([godbolt](https://godbolt.org/z/74h1xY9qK)): 1011 1012 ```c++ 1013 #include <fmt/ranges.h> 1014 #include <stack> 1015 #include <vector> 1016 1017 int main() { 1018 auto s = std::stack<bool, std::vector<bool>>(); 1019 for (auto b: {true, false, true}) s.push(b); 1020 fmt::print("{}\n", s); // prints [true, false, true] 1021 } 1022 ``` 1023 1024 Thanks @ShawnZhong. 1025 1026- Added a formatter for `std::optional` to `fmt/std.h` 1027 (https://github.com/fmtlib/fmt/issues/1367, 1028 https://github.com/fmtlib/fmt/pull/3303). 1029 Thanks @tom-huntington. 1030 1031- Fixed formatting of valueless by exception variants 1032 (https://github.com/fmtlib/fmt/pull/3347). Thanks @TheOmegaCarrot. 1033 1034- Made `fmt::ptr` accept `unique_ptr` with a custom deleter 1035 (https://github.com/fmtlib/fmt/pull/3177). Thanks @hmbj. 1036 1037- Fixed formatting of noncopyable ranges and nested ranges of chars 1038 (https://github.com/fmtlib/fmt/pull/3158 1039 https://github.com/fmtlib/fmt/issues/3286, 1040 https://github.com/fmtlib/fmt/pull/3290). Thanks @BRevzin. 1041 1042- Fixed issues with formatting of paths and ranges of paths 1043 (https://github.com/fmtlib/fmt/issues/3319, 1044 https://github.com/fmtlib/fmt/pull/3321 1045 https://github.com/fmtlib/fmt/issues/3322). Thanks @phprus. 1046 1047- Improved handling of invalid Unicode in paths. 1048 1049- Enabled compile-time checks on Apple clang 14 and later 1050 (https://github.com/fmtlib/fmt/pull/3331). Thanks @cloyce. 1051 1052- Improved compile-time checks of named arguments 1053 (https://github.com/fmtlib/fmt/issues/3105, 1054 https://github.com/fmtlib/fmt/pull/3214). Thanks @rbrich. 1055 1056- Fixed formatting when both alignment and `0` are given 1057 (https://github.com/fmtlib/fmt/issues/3236, 1058 https://github.com/fmtlib/fmt/pull/3248). Thanks @ShawnZhong. 1059 1060- Improved Unicode support in the experimental file API on Windows 1061 (https://github.com/fmtlib/fmt/issues/3234, 1062 https://github.com/fmtlib/fmt/pull/3293). Thanks @Fros1er. 1063 1064- Unified UTF transcoding 1065 (https://github.com/fmtlib/fmt/pull/3416). Thanks @phprus. 1066 1067- Added support for UTF-8 digit separators via an experimental locale 1068 facet (https://github.com/fmtlib/fmt/issues/1861). For 1069 example ([godbolt](https://godbolt.org/z/f7bcznb3W)): 1070 1071 ```c++ 1072 auto loc = std::locale( 1073 std::locale(), new fmt::format_facet<std::locale>("’")); 1074 auto s = fmt::format(loc, "{:L}", 1000); 1075 ``` 1076 1077 where `’` is U+2019 used as a digit separator in the de_CH locale. 1078 1079- Added an overload of `formatted_size` that takes a locale 1080 (https://github.com/fmtlib/fmt/issues/3084, 1081 https://github.com/fmtlib/fmt/pull/3087). Thanks @gerboengels. 1082 1083- Removed the deprecated `FMT_DEPRECATED_OSTREAM`. 1084 1085- Fixed a UB when using a null `std::string_view` with 1086 `fmt::to_string` or format string compilation 1087 (https://github.com/fmtlib/fmt/issues/3241, 1088 https://github.com/fmtlib/fmt/pull/3244). Thanks @phprus. 1089 1090- Added `starts_with` to the fallback `string_view` implementation 1091 (https://github.com/fmtlib/fmt/pull/3080). Thanks @phprus. 1092 1093- Added `fmt::basic_format_string::get()` for compatibility with 1094 `basic_format_string` 1095 (https://github.com/fmtlib/fmt/pull/3111). Thanks @huangqinjin. 1096 1097- Added `println` for compatibility with C++23 1098 (https://github.com/fmtlib/fmt/pull/3267). Thanks @ShawnZhong. 1099 1100- Renamed the `FMT_EXPORT` macro for shared library usage to 1101 `FMT_LIB_EXPORT`. 1102 1103- Improved documentation 1104 (https://github.com/fmtlib/fmt/issues/3108, 1105 https://github.com/fmtlib/fmt/issues/3169, 1106 https://github.com/fmtlib/fmt/pull/3243). 1107 https://github.com/fmtlib/fmt/pull/3404, 1108 https://github.com/fmtlib/fmt/pull/4002). 1109 Thanks @Cleroth, @Vertexwahn and @yujincheng08. 1110 1111- Improved build configuration and tests 1112 (https://github.com/fmtlib/fmt/pull/3118, 1113 https://github.com/fmtlib/fmt/pull/3120, 1114 https://github.com/fmtlib/fmt/pull/3188, 1115 https://github.com/fmtlib/fmt/issues/3189, 1116 https://github.com/fmtlib/fmt/pull/3198, 1117 https://github.com/fmtlib/fmt/pull/3205, 1118 https://github.com/fmtlib/fmt/pull/3207, 1119 https://github.com/fmtlib/fmt/pull/3210, 1120 https://github.com/fmtlib/fmt/pull/3240, 1121 https://github.com/fmtlib/fmt/pull/3256, 1122 https://github.com/fmtlib/fmt/pull/3264, 1123 https://github.com/fmtlib/fmt/issues/3299, 1124 https://github.com/fmtlib/fmt/pull/3302, 1125 https://github.com/fmtlib/fmt/pull/3312, 1126 https://github.com/fmtlib/fmt/issues/3317, 1127 https://github.com/fmtlib/fmt/pull/3328, 1128 https://github.com/fmtlib/fmt/pull/3333, 1129 https://github.com/fmtlib/fmt/pull/3369, 1130 https://github.com/fmtlib/fmt/issues/3373, 1131 https://github.com/fmtlib/fmt/pull/3395, 1132 https://github.com/fmtlib/fmt/pull/3406, 1133 https://github.com/fmtlib/fmt/pull/3411). 1134 Thanks @dimztimz, @phprus, @DavidKorczynski, @ChrisThrasher, 1135 @FrancoisCarouge, @kennyweiss, @luzpaz, @codeinred, @Mixaill, @joycebrum, 1136 @kevinhwang and @Vertexwahn. 1137 1138- Fixed a regression in handling empty format specifiers after a colon 1139 (`{:}`) (https://github.com/fmtlib/fmt/pull/3086). Thanks @oxidase. 1140 1141- Worked around a broken implementation of 1142 `std::is_constant_evaluated` in some versions of libstdc++ on clang 1143 (https://github.com/fmtlib/fmt/issues/3247, 1144 https://github.com/fmtlib/fmt/pull/3281). Thanks @phprus. 1145 1146- Fixed formatting of volatile variables 1147 (https://github.com/fmtlib/fmt/pull/3068). 1148 1149- Fixed various warnings and compilation issues 1150 (https://github.com/fmtlib/fmt/pull/3057, 1151 https://github.com/fmtlib/fmt/pull/3066, 1152 https://github.com/fmtlib/fmt/pull/3072, 1153 https://github.com/fmtlib/fmt/pull/3082, 1154 https://github.com/fmtlib/fmt/pull/3091, 1155 https://github.com/fmtlib/fmt/issues/3092, 1156 https://github.com/fmtlib/fmt/pull/3093, 1157 https://github.com/fmtlib/fmt/pull/3095, 1158 https://github.com/fmtlib/fmt/issues/3096, 1159 https://github.com/fmtlib/fmt/pull/3097, 1160 https://github.com/fmtlib/fmt/issues/3128, 1161 https://github.com/fmtlib/fmt/pull/3129, 1162 https://github.com/fmtlib/fmt/pull/3137, 1163 https://github.com/fmtlib/fmt/pull/3139, 1164 https://github.com/fmtlib/fmt/issues/3140, 1165 https://github.com/fmtlib/fmt/pull/3142, 1166 https://github.com/fmtlib/fmt/issues/3149, 1167 https://github.com/fmtlib/fmt/pull/3150, 1168 https://github.com/fmtlib/fmt/issues/3154, 1169 https://github.com/fmtlib/fmt/issues/3163, 1170 https://github.com/fmtlib/fmt/issues/3178, 1171 https://github.com/fmtlib/fmt/pull/3184, 1172 https://github.com/fmtlib/fmt/pull/3196, 1173 https://github.com/fmtlib/fmt/issues/3204, 1174 https://github.com/fmtlib/fmt/pull/3206, 1175 https://github.com/fmtlib/fmt/pull/3208, 1176 https://github.com/fmtlib/fmt/issues/3213, 1177 https://github.com/fmtlib/fmt/pull/3216, 1178 https://github.com/fmtlib/fmt/issues/3224, 1179 https://github.com/fmtlib/fmt/issues/3226, 1180 https://github.com/fmtlib/fmt/issues/3228, 1181 https://github.com/fmtlib/fmt/pull/3229, 1182 https://github.com/fmtlib/fmt/pull/3259, 1183 https://github.com/fmtlib/fmt/issues/3274, 1184 https://github.com/fmtlib/fmt/issues/3287, 1185 https://github.com/fmtlib/fmt/pull/3288, 1186 https://github.com/fmtlib/fmt/issues/3292, 1187 https://github.com/fmtlib/fmt/pull/3295, 1188 https://github.com/fmtlib/fmt/pull/3296, 1189 https://github.com/fmtlib/fmt/issues/3298, 1190 https://github.com/fmtlib/fmt/issues/3325, 1191 https://github.com/fmtlib/fmt/pull/3326, 1192 https://github.com/fmtlib/fmt/issues/3334, 1193 https://github.com/fmtlib/fmt/issues/3342, 1194 https://github.com/fmtlib/fmt/pull/3343, 1195 https://github.com/fmtlib/fmt/issues/3351, 1196 https://github.com/fmtlib/fmt/pull/3352, 1197 https://github.com/fmtlib/fmt/pull/3362, 1198 https://github.com/fmtlib/fmt/issues/3365, 1199 https://github.com/fmtlib/fmt/pull/3366, 1200 https://github.com/fmtlib/fmt/pull/3374, 1201 https://github.com/fmtlib/fmt/issues/3377, 1202 https://github.com/fmtlib/fmt/pull/3378, 1203 https://github.com/fmtlib/fmt/issues/3381, 1204 https://github.com/fmtlib/fmt/pull/3398, 1205 https://github.com/fmtlib/fmt/pull/3413, 1206 https://github.com/fmtlib/fmt/issues/3415). 1207 Thanks @phprus, @gsjaardema, @NewbieOrange, @EngineLessCC, @asmaloney, 1208 @HazardyKnusperkeks, @sergiud, @Youw, @thesmurph, @czudziakm, 1209 @Roman-Koshelev, @chronoxor, @ShawnZhong, @russelltg, @glebm, @tmartin-gh, 1210 @Zhaojun-Liu, @louiswins and @mogemimi. 1211 1212# 9.1.0 - 2022-08-27 1213 1214- `fmt::formatted_size` now works at compile time 1215 (https://github.com/fmtlib/fmt/pull/3026). For example 1216 ([godbolt](https://godbolt.org/z/1MW5rMdf8)): 1217 1218 ```c++ 1219 #include <fmt/compile.h> 1220 1221 int main() { 1222 using namespace fmt::literals; 1223 constexpr size_t n = fmt::formatted_size("{}"_cf, 42); 1224 fmt::print("{}\n", n); // prints 2 1225 } 1226 ``` 1227 1228 Thanks @marksantaniello. 1229 1230- Fixed handling of invalid UTF-8 1231 (https://github.com/fmtlib/fmt/pull/3038, 1232 https://github.com/fmtlib/fmt/pull/3044, 1233 https://github.com/fmtlib/fmt/pull/3056). 1234 Thanks @phprus and @skeeto. 1235 1236- Improved Unicode support in `ostream` overloads of `print` 1237 (https://github.com/fmtlib/fmt/pull/2994, 1238 https://github.com/fmtlib/fmt/pull/3001, 1239 https://github.com/fmtlib/fmt/pull/3025). Thanks @dimztimz. 1240 1241- Fixed handling of the sign specifier in localized formatting on 1242 systems with 32-bit `wchar_t` 1243 (https://github.com/fmtlib/fmt/issues/3041). 1244 1245- Added support for wide streams to `fmt::streamed` 1246 (https://github.com/fmtlib/fmt/pull/2994). Thanks @phprus. 1247 1248- Added the `n` specifier that disables the output of delimiters when 1249 formatting ranges (https://github.com/fmtlib/fmt/pull/2981, 1250 https://github.com/fmtlib/fmt/pull/2983). For example 1251 ([godbolt](https://godbolt.org/z/roKqGdj8c)): 1252 1253 ```c++ 1254 #include <fmt/ranges.h> 1255 #include <vector> 1256 1257 int main() { 1258 auto v = std::vector{1, 2, 3}; 1259 fmt::print("{:n}\n", v); // prints 1, 2, 3 1260 } 1261 ``` 1262 1263 Thanks @BRevzin. 1264 1265- Worked around problematic `std::string_view` constructors introduced 1266 in C++23 (https://github.com/fmtlib/fmt/issues/3030, 1267 https://github.com/fmtlib/fmt/issues/3050). Thanks @strega-nil-ms. 1268 1269- Improve handling (exclusion) of recursive ranges 1270 (https://github.com/fmtlib/fmt/issues/2968, 1271 https://github.com/fmtlib/fmt/pull/2974). Thanks @Dani-Hub. 1272 1273- Improved error reporting in format string compilation 1274 (https://github.com/fmtlib/fmt/issues/3055). 1275 1276- Improved the implementation of 1277 [Dragonbox](https://github.com/jk-jeon/dragonbox), the algorithm 1278 used for the default floating-point formatting 1279 (https://github.com/fmtlib/fmt/pull/2984). Thanks @jk-jeon. 1280 1281- Fixed issues with floating-point formatting on exotic platforms. 1282 1283- Improved the implementation of chrono formatting 1284 (https://github.com/fmtlib/fmt/pull/3010). Thanks @phprus. 1285 1286- Improved documentation 1287 (https://github.com/fmtlib/fmt/pull/2966, 1288 https://github.com/fmtlib/fmt/pull/3009, 1289 https://github.com/fmtlib/fmt/issues/3020, 1290 https://github.com/fmtlib/fmt/pull/3037). 1291 Thanks @mwinterb, @jcelerier and @remiburtin. 1292 1293- Improved build configuration 1294 (https://github.com/fmtlib/fmt/pull/2991, 1295 https://github.com/fmtlib/fmt/pull/2995, 1296 https://github.com/fmtlib/fmt/issues/3004, 1297 https://github.com/fmtlib/fmt/pull/3007, 1298 https://github.com/fmtlib/fmt/pull/3040). 1299 Thanks @dimztimz and @hwhsu1231. 1300 1301- Fixed various warnings and compilation issues 1302 (https://github.com/fmtlib/fmt/issues/2969, 1303 https://github.com/fmtlib/fmt/pull/2971, 1304 https://github.com/fmtlib/fmt/issues/2975, 1305 https://github.com/fmtlib/fmt/pull/2982, 1306 https://github.com/fmtlib/fmt/pull/2985, 1307 https://github.com/fmtlib/fmt/issues/2988, 1308 https://github.com/fmtlib/fmt/issues/2989, 1309 https://github.com/fmtlib/fmt/issues/3000, 1310 https://github.com/fmtlib/fmt/issues/3006, 1311 https://github.com/fmtlib/fmt/issues/3014, 1312 https://github.com/fmtlib/fmt/issues/3015, 1313 https://github.com/fmtlib/fmt/pull/3021, 1314 https://github.com/fmtlib/fmt/issues/3023, 1315 https://github.com/fmtlib/fmt/pull/3024, 1316 https://github.com/fmtlib/fmt/pull/3029, 1317 https://github.com/fmtlib/fmt/pull/3043, 1318 https://github.com/fmtlib/fmt/issues/3052, 1319 https://github.com/fmtlib/fmt/pull/3053, 1320 https://github.com/fmtlib/fmt/pull/3054). 1321 Thanks @h-friederich, @dimztimz, @olupton, @bernhardmgruber and @phprus. 1322 1323# 9.0.0 - 2022-07-04 1324 1325- Switched to the internal floating point formatter for all decimal 1326 presentation formats. In particular this results in consistent 1327 rounding on all platforms and removing the `s[n]printf` fallback for 1328 decimal FP formatting. 1329 1330- Compile-time floating point formatting no longer requires the 1331 header-only mode. For example 1332 ([godbolt](https://godbolt.org/z/G37PTeG3b)): 1333 1334 ```c++ 1335 #include <array> 1336 #include <fmt/compile.h> 1337 1338 consteval auto compile_time_dtoa(double value) -> std::array<char, 10> { 1339 auto result = std::array<char, 10>(); 1340 fmt::format_to(result.data(), FMT_COMPILE("{}"), value); 1341 return result; 1342 } 1343 1344 constexpr auto answer = compile_time_dtoa(0.42); 1345 ``` 1346 1347 works with the default settings. 1348 1349- Improved the implementation of 1350 [Dragonbox](https://github.com/jk-jeon/dragonbox), the algorithm 1351 used for the default floating-point formatting 1352 (https://github.com/fmtlib/fmt/pull/2713, 1353 https://github.com/fmtlib/fmt/pull/2750). Thanks @jk-jeon. 1354 1355- Made `fmt::to_string` work with `__float128`. This uses the internal 1356 FP formatter and works even on system without `__float128` support 1357 in `[s]printf`. 1358 1359- Disabled automatic `std::ostream` insertion operator (`operator<<`) 1360 discovery when `fmt/ostream.h` is included to prevent ODR 1361 violations. You can get the old behavior by defining 1362 `FMT_DEPRECATED_OSTREAM` but this will be removed in the next major 1363 release. Use `fmt::streamed` or `fmt::ostream_formatter` to enable 1364 formatting via `std::ostream` instead. 1365 1366- Added `fmt::ostream_formatter` that can be used to write `formatter` 1367 specializations that perform formatting via `std::ostream`. For 1368 example ([godbolt](https://godbolt.org/z/5sEc5qMsf)): 1369 1370 ```c++ 1371 #include <fmt/ostream.h> 1372 1373 struct date { 1374 int year, month, day; 1375 1376 friend std::ostream& operator<<(std::ostream& os, const date& d) { 1377 return os << d.year << '-' << d.month << '-' << d.day; 1378 } 1379 }; 1380 1381 template <> struct fmt::formatter<date> : ostream_formatter {}; 1382 1383 std::string s = fmt::format("The date is {}", date{2012, 12, 9}); 1384 // s == "The date is 2012-12-9" 1385 ``` 1386 1387- Added the `fmt::streamed` function that takes an object and formats 1388 it via `std::ostream`. For example 1389 ([godbolt](https://godbolt.org/z/5G3346G1f)): 1390 1391 ```c++ 1392 #include <thread> 1393 #include <fmt/ostream.h> 1394 1395 int main() { 1396 fmt::print("Current thread id: {}\n", 1397 fmt::streamed(std::this_thread::get_id())); 1398 } 1399 ``` 1400 1401 Note that `fmt/std.h` provides a `formatter` specialization for 1402 `std::thread::id` so you don\'t need to format it via 1403 `std::ostream`. 1404 1405- Deprecated implicit conversions of unscoped enums to integers for 1406 consistency with scoped enums. 1407 1408- Added an argument-dependent lookup based `format_as` extension API 1409 to simplify formatting of enums. 1410 1411- Added experimental `std::variant` formatting support 1412 (https://github.com/fmtlib/fmt/pull/2941). For example 1413 ([godbolt](https://godbolt.org/z/KG9z6cq68)): 1414 1415 ```c++ 1416 #include <variant> 1417 #include <fmt/std.h> 1418 1419 int main() { 1420 auto v = std::variant<int, std::string>(42); 1421 fmt::print("{}\n", v); 1422 } 1423 ``` 1424 1425 prints: 1426 1427 variant(42) 1428 1429 Thanks @jehelset. 1430 1431- Added experimental `std::filesystem::path` formatting support 1432 (https://github.com/fmtlib/fmt/issues/2865, 1433 https://github.com/fmtlib/fmt/pull/2902, 1434 https://github.com/fmtlib/fmt/issues/2917, 1435 https://github.com/fmtlib/fmt/pull/2918). For example 1436 ([godbolt](https://godbolt.org/z/o44dMexEb)): 1437 1438 ```c++ 1439 #include <filesystem> 1440 #include <fmt/std.h> 1441 1442 int main() { 1443 fmt::print("There is no place like {}.", std::filesystem::path("/home")); 1444 } 1445 ``` 1446 1447 prints: 1448 1449 There is no place like "/home". 1450 1451 Thanks @phprus. 1452 1453- Added a `std::thread::id` formatter to `fmt/std.h`. For example 1454 ([godbolt](https://godbolt.org/z/j1azbYf3E)): 1455 1456 ```c++ 1457 #include <thread> 1458 #include <fmt/std.h> 1459 1460 int main() { 1461 fmt::print("Current thread id: {}\n", std::this_thread::get_id()); 1462 } 1463 ``` 1464 1465- Added `fmt::styled` that applies a text style to an individual 1466 argument (https://github.com/fmtlib/fmt/pull/2793). For 1467 example ([godbolt](https://godbolt.org/z/vWGW7v5M6)): 1468 1469 ```c++ 1470 #include <fmt/chrono.h> 1471 #include <fmt/color.h> 1472 1473 int main() { 1474 auto now = std::chrono::system_clock::now(); 1475 fmt::print( 1476 "[{}] {}: {}\n", 1477 fmt::styled(now, fmt::emphasis::bold), 1478 fmt::styled("error", fg(fmt::color::red)), 1479 "something went wrong"); 1480 } 1481 ``` 1482 1483 prints 1484 1485  1486 1487 Thanks @rbrugo. 1488 1489- Made `fmt::print` overload for text styles correctly handle UTF-8 1490 (https://github.com/fmtlib/fmt/issues/2681, 1491 https://github.com/fmtlib/fmt/pull/2701). Thanks @AlexGuteniev. 1492 1493- Fixed Unicode handling when writing to an ostream. 1494 1495- Added support for nested specifiers to range formatting 1496 (https://github.com/fmtlib/fmt/pull/2673). For example 1497 ([godbolt](https://godbolt.org/z/xd3Gj38cf)): 1498 1499 ```c++ 1500 #include <vector> 1501 #include <fmt/ranges.h> 1502 1503 int main() { 1504 fmt::print("{::#x}\n", std::vector{10, 20, 30}); 1505 } 1506 ``` 1507 1508 prints `[0xa, 0x14, 0x1e]`. 1509 1510 Thanks @BRevzin. 1511 1512- Implemented escaping of wide strings in ranges 1513 (https://github.com/fmtlib/fmt/pull/2904). Thanks @phprus. 1514 1515- Added support for ranges with `begin` / `end` found via the 1516 argument-dependent lookup 1517 (https://github.com/fmtlib/fmt/pull/2807). Thanks @rbrugo. 1518 1519- Fixed formatting of certain kinds of ranges of ranges 1520 (https://github.com/fmtlib/fmt/pull/2787). Thanks @BRevzin. 1521 1522- Fixed handling of maps with element types other than `std::pair` 1523 (https://github.com/fmtlib/fmt/pull/2944). Thanks @BrukerJWD. 1524 1525- Made tuple formatter enabled only if elements are formattable 1526 (https://github.com/fmtlib/fmt/issues/2939, 1527 https://github.com/fmtlib/fmt/pull/2940). Thanks @jehelset. 1528 1529- Made `fmt::join` compatible with format string compilation 1530 (https://github.com/fmtlib/fmt/issues/2719, 1531 https://github.com/fmtlib/fmt/pull/2720). Thanks @phprus. 1532 1533- Made compile-time checks work with named arguments of custom types 1534 and `std::ostream` `print` overloads 1535 (https://github.com/fmtlib/fmt/issues/2816, 1536 https://github.com/fmtlib/fmt/issues/2817, 1537 https://github.com/fmtlib/fmt/pull/2819). Thanks @timsong-cpp. 1538 1539- Removed `make_args_checked` because it is no longer needed for 1540 compile-time checks 1541 (https://github.com/fmtlib/fmt/pull/2760). Thanks @phprus. 1542 1543- Removed the following deprecated APIs: `_format`, `arg_join`, the 1544 `format_to` overload that takes a memory buffer, `[v]fprintf` that 1545 takes an `ostream`. 1546 1547- Removed the deprecated implicit conversion of `[const] signed char*` 1548 and `[const] unsigned char*` to C strings. 1549 1550- Removed the deprecated `fmt/locale.h`. 1551 1552- Replaced the deprecated `fileno()` with `descriptor()` in 1553 `buffered_file`. 1554 1555- Moved `to_string_view` to the `detail` namespace since it\'s an 1556 implementation detail. 1557 1558- Made access mode of a created file consistent with `fopen` by 1559 setting `S_IWGRP` and `S_IWOTH` 1560 (https://github.com/fmtlib/fmt/pull/2733). Thanks @arogge. 1561 1562- Removed a redundant buffer resize when formatting to `std::ostream` 1563 (https://github.com/fmtlib/fmt/issues/2842, 1564 https://github.com/fmtlib/fmt/pull/2843). Thanks @jcelerier. 1565 1566- Made precision computation for strings consistent with width 1567 (https://github.com/fmtlib/fmt/issues/2888). 1568 1569- Fixed handling of locale separators in floating point formatting 1570 (https://github.com/fmtlib/fmt/issues/2830). 1571 1572- Made sign specifiers work with `__int128_t` 1573 (https://github.com/fmtlib/fmt/issues/2773). 1574 1575- Improved support for systems such as CHERI with extra data stored in 1576 pointers (https://github.com/fmtlib/fmt/pull/2932). 1577 Thanks @davidchisnall. 1578 1579- Improved documentation 1580 (https://github.com/fmtlib/fmt/pull/2706, 1581 https://github.com/fmtlib/fmt/pull/2712, 1582 https://github.com/fmtlib/fmt/pull/2789, 1583 https://github.com/fmtlib/fmt/pull/2803, 1584 https://github.com/fmtlib/fmt/pull/2805, 1585 https://github.com/fmtlib/fmt/pull/2815, 1586 https://github.com/fmtlib/fmt/pull/2924). 1587 Thanks @BRevzin, @Pokechu22, @setoye, @rtobar, @rbrugo, @anoonD and 1588 @leha-bot. 1589 1590- Improved build configuration 1591 (https://github.com/fmtlib/fmt/pull/2766, 1592 https://github.com/fmtlib/fmt/pull/2772, 1593 https://github.com/fmtlib/fmt/pull/2836, 1594 https://github.com/fmtlib/fmt/pull/2852, 1595 https://github.com/fmtlib/fmt/pull/2907, 1596 https://github.com/fmtlib/fmt/pull/2913, 1597 https://github.com/fmtlib/fmt/pull/2914). 1598 Thanks @kambala-decapitator, @mattiasljungstrom, @kieselnb, @nathannaveen 1599 and @Vertexwahn. 1600 1601- Fixed various warnings and compilation issues 1602 (https://github.com/fmtlib/fmt/issues/2408, 1603 https://github.com/fmtlib/fmt/issues/2507, 1604 https://github.com/fmtlib/fmt/issues/2697, 1605 https://github.com/fmtlib/fmt/issues/2715, 1606 https://github.com/fmtlib/fmt/issues/2717, 1607 https://github.com/fmtlib/fmt/pull/2722, 1608 https://github.com/fmtlib/fmt/pull/2724, 1609 https://github.com/fmtlib/fmt/pull/2725, 1610 https://github.com/fmtlib/fmt/issues/2726, 1611 https://github.com/fmtlib/fmt/pull/2728, 1612 https://github.com/fmtlib/fmt/pull/2732, 1613 https://github.com/fmtlib/fmt/issues/2738, 1614 https://github.com/fmtlib/fmt/pull/2742, 1615 https://github.com/fmtlib/fmt/issues/2744, 1616 https://github.com/fmtlib/fmt/issues/2745, 1617 https://github.com/fmtlib/fmt/issues/2746, 1618 https://github.com/fmtlib/fmt/issues/2754, 1619 https://github.com/fmtlib/fmt/pull/2755, 1620 https://github.com/fmtlib/fmt/issues/2757, 1621 https://github.com/fmtlib/fmt/pull/2758, 1622 https://github.com/fmtlib/fmt/issues/2761, 1623 https://github.com/fmtlib/fmt/pull/2762, 1624 https://github.com/fmtlib/fmt/issues/2763, 1625 https://github.com/fmtlib/fmt/pull/2765, 1626 https://github.com/fmtlib/fmt/issues/2769, 1627 https://github.com/fmtlib/fmt/pull/2770, 1628 https://github.com/fmtlib/fmt/issues/2771, 1629 https://github.com/fmtlib/fmt/issues/2777, 1630 https://github.com/fmtlib/fmt/pull/2779, 1631 https://github.com/fmtlib/fmt/pull/2782, 1632 https://github.com/fmtlib/fmt/pull/2783, 1633 https://github.com/fmtlib/fmt/issues/2794, 1634 https://github.com/fmtlib/fmt/issues/2796, 1635 https://github.com/fmtlib/fmt/pull/2797, 1636 https://github.com/fmtlib/fmt/pull/2801, 1637 https://github.com/fmtlib/fmt/pull/2802, 1638 https://github.com/fmtlib/fmt/issues/2808, 1639 https://github.com/fmtlib/fmt/issues/2818, 1640 https://github.com/fmtlib/fmt/pull/2819, 1641 https://github.com/fmtlib/fmt/issues/2829, 1642 https://github.com/fmtlib/fmt/issues/2835, 1643 https://github.com/fmtlib/fmt/issues/2848, 1644 https://github.com/fmtlib/fmt/issues/2860, 1645 https://github.com/fmtlib/fmt/pull/2861, 1646 https://github.com/fmtlib/fmt/pull/2882, 1647 https://github.com/fmtlib/fmt/issues/2886, 1648 https://github.com/fmtlib/fmt/issues/2891, 1649 https://github.com/fmtlib/fmt/pull/2892, 1650 https://github.com/fmtlib/fmt/issues/2895, 1651 https://github.com/fmtlib/fmt/issues/2896, 1652 https://github.com/fmtlib/fmt/pull/2903, 1653 https://github.com/fmtlib/fmt/issues/2906, 1654 https://github.com/fmtlib/fmt/issues/2908, 1655 https://github.com/fmtlib/fmt/pull/2909, 1656 https://github.com/fmtlib/fmt/issues/2920, 1657 https://github.com/fmtlib/fmt/pull/2922, 1658 https://github.com/fmtlib/fmt/pull/2927, 1659 https://github.com/fmtlib/fmt/pull/2929, 1660 https://github.com/fmtlib/fmt/issues/2936, 1661 https://github.com/fmtlib/fmt/pull/2937, 1662 https://github.com/fmtlib/fmt/pull/2938, 1663 https://github.com/fmtlib/fmt/pull/2951, 1664 https://github.com/fmtlib/fmt/issues/2954, 1665 https://github.com/fmtlib/fmt/pull/2957, 1666 https://github.com/fmtlib/fmt/issues/2958, 1667 https://github.com/fmtlib/fmt/pull/2960). 1668 Thanks @matrackif @Tobi823, @ivan-volnov, @VasiliPupkin256, 1669 @federico-busato, @barcharcraz, @jk-jeon, @HazardyKnusperkeks, @dalboris, 1670 @seanm, @gsjaardema, @timsong-cpp, @seanm, @frithrah, @chronoxor, @Agga, 1671 @madmaxoft, @JurajX, @phprus and @Dani-Hub. 1672 1673# 8.1.1 - 2022-01-06 1674 1675- Restored ABI compatibility with version 8.0.x 1676 (https://github.com/fmtlib/fmt/issues/2695, 1677 https://github.com/fmtlib/fmt/pull/2696). Thanks @saraedum. 1678- Fixed chrono formatting on big endian systems 1679 (https://github.com/fmtlib/fmt/issues/2698, 1680 https://github.com/fmtlib/fmt/pull/2699). 1681 Thanks @phprus and @xvitaly. 1682- Fixed a linkage error with mingw 1683 (https://github.com/fmtlib/fmt/issues/2691, 1684 https://github.com/fmtlib/fmt/pull/2692). Thanks @rbberger. 1685 1686# 8.1.0 - 2022-01-02 1687 1688- Optimized chrono formatting 1689 (https://github.com/fmtlib/fmt/pull/2500, 1690 https://github.com/fmtlib/fmt/pull/2537, 1691 https://github.com/fmtlib/fmt/issues/2541, 1692 https://github.com/fmtlib/fmt/pull/2544, 1693 https://github.com/fmtlib/fmt/pull/2550, 1694 https://github.com/fmtlib/fmt/pull/2551, 1695 https://github.com/fmtlib/fmt/pull/2576, 1696 https://github.com/fmtlib/fmt/issues/2577, 1697 https://github.com/fmtlib/fmt/pull/2586, 1698 https://github.com/fmtlib/fmt/pull/2591, 1699 https://github.com/fmtlib/fmt/pull/2594, 1700 https://github.com/fmtlib/fmt/pull/2602, 1701 https://github.com/fmtlib/fmt/pull/2617, 1702 https://github.com/fmtlib/fmt/issues/2628, 1703 https://github.com/fmtlib/fmt/pull/2633, 1704 https://github.com/fmtlib/fmt/issues/2670, 1705 https://github.com/fmtlib/fmt/pull/2671). 1706 1707 Processing of some specifiers such as `%z` and `%Y` is now up to 1708 10-20 times faster, for example on GCC 11 with libstdc++: 1709 1710 ---------------------------------------------------------------------------- 1711 Benchmark Before After 1712 ---------------------------------------------------------------------------- 1713 FMTFormatter_z 261 ns 26.3 ns 1714 FMTFormatterCompile_z 246 ns 11.6 ns 1715 FMTFormatter_Y 263 ns 26.1 ns 1716 FMTFormatterCompile_Y 244 ns 10.5 ns 1717 ---------------------------------------------------------------------------- 1718 1719 Thanks @phprus and @toughengineer. 1720 1721- Implemented subsecond formatting for chrono durations 1722 (https://github.com/fmtlib/fmt/pull/2623). For example 1723 ([godbolt](https://godbolt.org/z/es7vWTETe)): 1724 1725 ```c++ 1726 #include <fmt/chrono.h> 1727 1728 int main() { 1729 fmt::print("{:%S}", std::chrono::milliseconds(1234)); 1730 } 1731 ``` 1732 1733 prints \"01.234\". 1734 1735 Thanks @matrackif. 1736 1737- Fixed handling of precision 0 when formatting chrono durations 1738 (https://github.com/fmtlib/fmt/issues/2587, 1739 https://github.com/fmtlib/fmt/pull/2588). Thanks @lukester1975. 1740 1741- Fixed an overflow on invalid inputs in the `tm` formatter 1742 (https://github.com/fmtlib/fmt/pull/2564). Thanks @phprus. 1743 1744- Added `fmt::group_digits` that formats integers with a non-localized 1745 digit separator (comma) for groups of three digits. For example 1746 ([godbolt](https://godbolt.org/z/TxGxG9Poq)): 1747 1748 ```c++ 1749 #include <fmt/format.h> 1750 1751 int main() { 1752 fmt::print("{} dollars", fmt::group_digits(1000000)); 1753 } 1754 ``` 1755 1756 prints \"1,000,000 dollars\". 1757 1758- Added support for faint, conceal, reverse and blink text styles 1759 (https://github.com/fmtlib/fmt/pull/2394): 1760 1761 <https://user-images.githubusercontent.com/576385/147710227-c68f5317-f8fa-42c3-9123-7c4ba3c398cb.mp4> 1762 1763 Thanks @benit8 and @data-man. 1764 1765- Added experimental support for compile-time floating point 1766 formatting (https://github.com/fmtlib/fmt/pull/2426, 1767 https://github.com/fmtlib/fmt/pull/2470). It is currently 1768 limited to the header-only mode. Thanks @alexezeder. 1769 1770- Added UDL-based named argument support to compile-time format string 1771 checks (https://github.com/fmtlib/fmt/issues/2640, 1772 https://github.com/fmtlib/fmt/pull/2649). For example 1773 ([godbolt](https://godbolt.org/z/ohGbbvonv)): 1774 1775 ```c++ 1776 #include <fmt/format.h> 1777 1778 int main() { 1779 using namespace fmt::literals; 1780 fmt::print("{answer:s}", "answer"_a=42); 1781 } 1782 ``` 1783 1784 gives a compile-time error on compilers with C++20 `consteval` and 1785 non-type template parameter support (gcc 10+) because `s` is not a 1786 valid format specifier for an integer. 1787 1788 Thanks @alexezeder. 1789 1790- Implemented escaping of string range elements. For example 1791 ([godbolt](https://godbolt.org/z/rKvM1vKf3)): 1792 1793 ```c++ 1794 #include <fmt/ranges.h> 1795 #include <vector> 1796 1797 int main() { 1798 fmt::print("{}", std::vector<std::string>{"\naan"}); 1799 } 1800 ``` 1801 1802 is now printed as: 1803 1804 ["\naan"] 1805 1806 instead of: 1807 1808 [" 1809 aan"] 1810 1811- Added an experimental `?` specifier for escaping strings. 1812 (https://github.com/fmtlib/fmt/pull/2674). Thanks @BRevzin. 1813 1814- Switched to JSON-like representation of maps and sets for 1815 consistency with Python\'s `str.format`. For example 1816 ([godbolt](https://godbolt.org/z/seKjoY9W5)): 1817 1818 ```c++ 1819 #include <fmt/ranges.h> 1820 #include <map> 1821 1822 int main() { 1823 fmt::print("{}", std::map<std::string, int>{{"answer", 42}}); 1824 } 1825 ``` 1826 1827 is now printed as: 1828 1829 {"answer": 42} 1830 1831- Extended `fmt::join` to support C++20-only ranges 1832 (https://github.com/fmtlib/fmt/pull/2549). Thanks @BRevzin. 1833 1834- Optimized handling of non-const-iterable ranges and implemented 1835 initial support for non-const-formattable types. 1836 1837- Disabled implicit conversions of scoped enums to integers that was 1838 accidentally introduced in earlier versions 1839 (https://github.com/fmtlib/fmt/pull/1841). 1840 1841- Deprecated implicit conversion of `[const] signed char*` and 1842 `[const] unsigned char*` to C strings. 1843 1844- Deprecated `_format`, a legacy UDL-based format API 1845 (https://github.com/fmtlib/fmt/pull/2646). Thanks @alexezeder. 1846 1847- Marked `format`, `formatted_size` and `to_string` as `[[nodiscard]]` 1848 (https://github.com/fmtlib/fmt/pull/2612). @0x8000-0000. 1849 1850- Added missing diagnostic when trying to format function and member 1851 pointers as well as objects convertible to pointers which is 1852 explicitly disallowed 1853 (https://github.com/fmtlib/fmt/issues/2598, 1854 https://github.com/fmtlib/fmt/pull/2609, 1855 https://github.com/fmtlib/fmt/pull/2610). Thanks @AlexGuteniev. 1856 1857- Optimized writing to a contiguous buffer with `format_to_n` 1858 (https://github.com/fmtlib/fmt/pull/2489). Thanks @Roman-Koshelev. 1859 1860- Optimized writing to non-`char` buffers 1861 (https://github.com/fmtlib/fmt/pull/2477). Thanks @Roman-Koshelev. 1862 1863- Decimal point is now localized when using the `L` specifier. 1864 1865- Improved floating point formatter implementation 1866 (https://github.com/fmtlib/fmt/pull/2498, 1867 https://github.com/fmtlib/fmt/pull/2499). Thanks @Roman-Koshelev. 1868 1869- Fixed handling of very large precision in fixed format 1870 (https://github.com/fmtlib/fmt/pull/2616). 1871 1872- Made a table of cached powers used in FP formatting static 1873 (https://github.com/fmtlib/fmt/pull/2509). Thanks @jk-jeon. 1874 1875- Resolved a lookup ambiguity with C++20 format-related functions due 1876 to ADL (https://github.com/fmtlib/fmt/issues/2639, 1877 https://github.com/fmtlib/fmt/pull/2641). Thanks @mkurdej. 1878 1879- Removed unnecessary inline namespace qualification 1880 (https://github.com/fmtlib/fmt/issues/2642, 1881 https://github.com/fmtlib/fmt/pull/2643). Thanks @mkurdej. 1882 1883- Implemented argument forwarding in `format_to_n` 1884 (https://github.com/fmtlib/fmt/issues/2462, 1885 https://github.com/fmtlib/fmt/pull/2463). Thanks @owent. 1886 1887- Fixed handling of implicit conversions in `fmt::to_string` and 1888 format string compilation 1889 (https://github.com/fmtlib/fmt/issues/2565). 1890 1891- Changed the default access mode of files created by 1892 `fmt::output_file` to `-rw-r--r--` for consistency with `fopen` 1893 (https://github.com/fmtlib/fmt/issues/2530). 1894 1895- Make `fmt::ostream::flush` public 1896 (https://github.com/fmtlib/fmt/issues/2435). 1897 1898- Improved C++14/17 attribute detection 1899 (https://github.com/fmtlib/fmt/pull/2615). Thanks @AlexGuteniev. 1900 1901- Improved `consteval` detection for MSVC 1902 (https://github.com/fmtlib/fmt/pull/2559). Thanks @DanielaE. 1903 1904- Improved documentation 1905 (https://github.com/fmtlib/fmt/issues/2406, 1906 https://github.com/fmtlib/fmt/pull/2446, 1907 https://github.com/fmtlib/fmt/issues/2493, 1908 https://github.com/fmtlib/fmt/issues/2513, 1909 https://github.com/fmtlib/fmt/pull/2515, 1910 https://github.com/fmtlib/fmt/issues/2522, 1911 https://github.com/fmtlib/fmt/pull/2562, 1912 https://github.com/fmtlib/fmt/pull/2575, 1913 https://github.com/fmtlib/fmt/pull/2606, 1914 https://github.com/fmtlib/fmt/pull/2620, 1915 https://github.com/fmtlib/fmt/issues/2676). 1916 Thanks @sobolevn, @UnePierre, @zhsj, @phprus, @ericcurtin and @Lounarok. 1917 1918- Improved fuzzers and added a fuzzer for chrono timepoint formatting 1919 (https://github.com/fmtlib/fmt/pull/2461, 1920 https://github.com/fmtlib/fmt/pull/2469). @pauldreik, 1921 1922- Added the `FMT_SYSTEM_HEADERS` CMake option setting which marks 1923 {fmt}\'s headers as system. It can be used to suppress warnings 1924 (https://github.com/fmtlib/fmt/issues/2644, 1925 https://github.com/fmtlib/fmt/pull/2651). Thanks @alexezeder. 1926 1927- Added the Bazel build system support 1928 (https://github.com/fmtlib/fmt/pull/2505, 1929 https://github.com/fmtlib/fmt/pull/2516). Thanks @Vertexwahn. 1930 1931- Improved build configuration and tests 1932 (https://github.com/fmtlib/fmt/issues/2437, 1933 https://github.com/fmtlib/fmt/pull/2558, 1934 https://github.com/fmtlib/fmt/pull/2648, 1935 https://github.com/fmtlib/fmt/pull/2650, 1936 https://github.com/fmtlib/fmt/pull/2663, 1937 https://github.com/fmtlib/fmt/pull/2677). 1938 Thanks @DanielaE, @alexezeder and @phprus. 1939 1940- Fixed various warnings and compilation issues 1941 (https://github.com/fmtlib/fmt/pull/2353, 1942 https://github.com/fmtlib/fmt/pull/2356, 1943 https://github.com/fmtlib/fmt/pull/2399, 1944 https://github.com/fmtlib/fmt/issues/2408, 1945 https://github.com/fmtlib/fmt/pull/2414, 1946 https://github.com/fmtlib/fmt/pull/2427, 1947 https://github.com/fmtlib/fmt/pull/2432, 1948 https://github.com/fmtlib/fmt/pull/2442, 1949 https://github.com/fmtlib/fmt/pull/2434, 1950 https://github.com/fmtlib/fmt/issues/2439, 1951 https://github.com/fmtlib/fmt/pull/2447, 1952 https://github.com/fmtlib/fmt/pull/2450, 1953 https://github.com/fmtlib/fmt/issues/2455, 1954 https://github.com/fmtlib/fmt/issues/2465, 1955 https://github.com/fmtlib/fmt/issues/2472, 1956 https://github.com/fmtlib/fmt/issues/2474, 1957 https://github.com/fmtlib/fmt/pull/2476, 1958 https://github.com/fmtlib/fmt/issues/2478, 1959 https://github.com/fmtlib/fmt/issues/2479, 1960 https://github.com/fmtlib/fmt/issues/2481, 1961 https://github.com/fmtlib/fmt/pull/2482, 1962 https://github.com/fmtlib/fmt/pull/2483, 1963 https://github.com/fmtlib/fmt/issues/2490, 1964 https://github.com/fmtlib/fmt/pull/2491, 1965 https://github.com/fmtlib/fmt/pull/2510, 1966 https://github.com/fmtlib/fmt/pull/2518, 1967 https://github.com/fmtlib/fmt/issues/2528, 1968 https://github.com/fmtlib/fmt/pull/2529, 1969 https://github.com/fmtlib/fmt/pull/2539, 1970 https://github.com/fmtlib/fmt/issues/2540, 1971 https://github.com/fmtlib/fmt/pull/2545, 1972 https://github.com/fmtlib/fmt/pull/2555, 1973 https://github.com/fmtlib/fmt/issues/2557, 1974 https://github.com/fmtlib/fmt/issues/2570, 1975 https://github.com/fmtlib/fmt/pull/2573, 1976 https://github.com/fmtlib/fmt/pull/2582, 1977 https://github.com/fmtlib/fmt/issues/2605, 1978 https://github.com/fmtlib/fmt/pull/2611, 1979 https://github.com/fmtlib/fmt/pull/2647, 1980 https://github.com/fmtlib/fmt/issues/2627, 1981 https://github.com/fmtlib/fmt/pull/2630, 1982 https://github.com/fmtlib/fmt/issues/2635, 1983 https://github.com/fmtlib/fmt/issues/2638, 1984 https://github.com/fmtlib/fmt/issues/2653, 1985 https://github.com/fmtlib/fmt/issues/2654, 1986 https://github.com/fmtlib/fmt/issues/2661, 1987 https://github.com/fmtlib/fmt/pull/2664, 1988 https://github.com/fmtlib/fmt/pull/2684). 1989 Thanks @DanielaE, @mwinterb, @cdacamar, @TrebledJ, @bodomartin, @cquammen, 1990 @white238, @mmarkeloff, @palacaze, @jcelerier, @mborn-adi, @BrukerJWD, 1991 @spyridon97, @phprus, @oliverlee, @joshessman-llnl, @akohlmey, @timkalu, 1992 @olupton, @Acretock, @alexezeder, @andrewcorrigan, @lucpelletier and 1993 @HazardyKnusperkeks. 1994 1995# 8.0.1 - 2021-07-02 1996 1997- Fixed the version number in the inline namespace 1998 (https://github.com/fmtlib/fmt/issues/2374). 1999- Added a missing presentation type check for `std::string` 2000 (https://github.com/fmtlib/fmt/issues/2402). 2001- Fixed a linkage error when mixing code built with clang and gcc 2002 (https://github.com/fmtlib/fmt/issues/2377). 2003- Fixed documentation issues 2004 (https://github.com/fmtlib/fmt/pull/2396, 2005 https://github.com/fmtlib/fmt/issues/2403, 2006 https://github.com/fmtlib/fmt/issues/2406). Thanks @mkurdej. 2007- Removed dead code in FP formatter ( 2008 https://github.com/fmtlib/fmt/pull/2398). Thanks @javierhonduco. 2009- Fixed various warnings and compilation issues 2010 (https://github.com/fmtlib/fmt/issues/2351, 2011 https://github.com/fmtlib/fmt/issues/2359, 2012 https://github.com/fmtlib/fmt/pull/2365, 2013 https://github.com/fmtlib/fmt/issues/2368, 2014 https://github.com/fmtlib/fmt/pull/2370, 2015 https://github.com/fmtlib/fmt/pull/2376, 2016 https://github.com/fmtlib/fmt/pull/2381, 2017 https://github.com/fmtlib/fmt/pull/2382, 2018 https://github.com/fmtlib/fmt/issues/2386, 2019 https://github.com/fmtlib/fmt/pull/2389, 2020 https://github.com/fmtlib/fmt/pull/2395, 2021 https://github.com/fmtlib/fmt/pull/2397, 2022 https://github.com/fmtlib/fmt/issues/2400, 2023 https://github.com/fmtlib/fmt/issues/2401, 2024 https://github.com/fmtlib/fmt/pull/2407). 2025 Thanks @zx2c4, @AidanSun05, @mattiasljungstrom, @joemmett, @erengy, 2026 @patlkli, @gsjaardema and @phprus. 2027 2028# 8.0.0 - 2021-06-21 2029 2030- Enabled compile-time format string checks by default. For example 2031 ([godbolt](https://godbolt.org/z/sMxcohGjz)): 2032 2033 ```c++ 2034 #include <fmt/core.h> 2035 2036 int main() { 2037 fmt::print("{:d}", "I am not a number"); 2038 } 2039 ``` 2040 2041 gives a compile-time error on compilers with C++20 `consteval` 2042 support (gcc 10+, clang 11+) because `d` is not a valid format 2043 specifier for a string. 2044 2045 To pass a runtime string wrap it in `fmt::runtime`: 2046 2047 ```c++ 2048 fmt::print(fmt::runtime("{:d}"), "I am not a number"); 2049 ``` 2050 2051- Added compile-time formatting 2052 (https://github.com/fmtlib/fmt/pull/2019, 2053 https://github.com/fmtlib/fmt/pull/2044, 2054 https://github.com/fmtlib/fmt/pull/2056, 2055 https://github.com/fmtlib/fmt/pull/2072, 2056 https://github.com/fmtlib/fmt/pull/2075, 2057 https://github.com/fmtlib/fmt/issues/2078, 2058 https://github.com/fmtlib/fmt/pull/2129, 2059 https://github.com/fmtlib/fmt/pull/2326). For example 2060 ([godbolt](https://godbolt.org/z/Mxx9d89jM)): 2061 2062 ```c++ 2063 #include <fmt/compile.h> 2064 2065 consteval auto compile_time_itoa(int value) -> std::array<char, 10> { 2066 auto result = std::array<char, 10>(); 2067 fmt::format_to(result.data(), FMT_COMPILE("{}"), value); 2068 return result; 2069 } 2070 2071 constexpr auto answer = compile_time_itoa(42); 2072 ``` 2073 2074 Most of the formatting functionality is available at compile time 2075 with a notable exception of floating-point numbers and pointers. 2076 Thanks @alexezeder. 2077 2078- Optimized handling of format specifiers during format string 2079 compilation. For example, hexadecimal formatting (`"{:x}"`) is now 2080 3-7x faster than before when using `format_to` with format string 2081 compilation and a stack-allocated buffer 2082 (https://github.com/fmtlib/fmt/issues/1944). 2083 2084 Before (7.1.3): 2085 2086 ---------------------------------------------------------------------------- 2087 Benchmark Time CPU Iterations 2088 ---------------------------------------------------------------------------- 2089 FMTCompileOld/0 15.5 ns 15.5 ns 43302898 2090 FMTCompileOld/42 16.6 ns 16.6 ns 43278267 2091 FMTCompileOld/273123 18.7 ns 18.6 ns 37035861 2092 FMTCompileOld/9223372036854775807 19.4 ns 19.4 ns 35243000 2093 ---------------------------------------------------------------------------- 2094 2095 After (8.x): 2096 2097 ---------------------------------------------------------------------------- 2098 Benchmark Time CPU Iterations 2099 ---------------------------------------------------------------------------- 2100 FMTCompileNew/0 1.99 ns 1.99 ns 360523686 2101 FMTCompileNew/42 2.33 ns 2.33 ns 279865664 2102 FMTCompileNew/273123 3.72 ns 3.71 ns 190230315 2103 FMTCompileNew/9223372036854775807 5.28 ns 5.26 ns 130711631 2104 ---------------------------------------------------------------------------- 2105 2106 It is even faster than `std::to_chars` from libc++ compiled with 2107 clang on macOS: 2108 2109 ---------------------------------------------------------------------------- 2110 Benchmark Time CPU Iterations 2111 ---------------------------------------------------------------------------- 2112 ToChars/0 4.42 ns 4.41 ns 160196630 2113 ToChars/42 5.00 ns 4.98 ns 140735201 2114 ToChars/273123 7.26 ns 7.24 ns 95784130 2115 ToChars/9223372036854775807 8.77 ns 8.75 ns 75872534 2116 ---------------------------------------------------------------------------- 2117 2118 In other cases, especially involving `std::string` construction, the 2119 speed up is usually lower because handling format specifiers takes a 2120 smaller fraction of the total time. 2121 2122- Added the `_cf` user-defined literal to represent a compiled format 2123 string. It can be used instead of the `FMT_COMPILE` macro 2124 (https://github.com/fmtlib/fmt/pull/2043, 2125 https://github.com/fmtlib/fmt/pull/2242): 2126 2127 ```c++ 2128 #include <fmt/compile.h> 2129 2130 using namespace fmt::literals; 2131 auto s = fmt::format(FMT_COMPILE("{}"), 42); // not modern 2132 auto s = fmt::format("{}"_cf, 42); // modern as hell 2133 ``` 2134 2135 It requires compiler support for class types in non-type template 2136 parameters (a C++20 feature) which is available in GCC 9.3+. 2137 Thanks @alexezeder. 2138 2139- Format string compilation now requires `format` functions of 2140 `formatter` specializations for user-defined types to be `const`: 2141 2142 ```c++ 2143 template <> struct fmt::formatter<my_type>: formatter<string_view> { 2144 template <typename FormatContext> 2145 auto format(my_type obj, FormatContext& ctx) const { // Note const here. 2146 // ... 2147 } 2148 }; 2149 ``` 2150 2151- Added UDL-based named argument support to format string compilation 2152 (https://github.com/fmtlib/fmt/pull/2243, 2153 https://github.com/fmtlib/fmt/pull/2281). For example: 2154 2155 ```c++ 2156 #include <fmt/compile.h> 2157 2158 using namespace fmt::literals; 2159 auto s = fmt::format(FMT_COMPILE("{answer}"), "answer"_a = 42); 2160 ``` 2161 2162 Here the argument named \"answer\" is resolved at compile time with 2163 no runtime overhead. Thanks @alexezeder. 2164 2165- Added format string compilation support to `fmt::print` 2166 (https://github.com/fmtlib/fmt/issues/2280, 2167 https://github.com/fmtlib/fmt/pull/2304). Thanks @alexezeder. 2168 2169- Added initial support for compiling {fmt} as a C++20 module 2170 (https://github.com/fmtlib/fmt/pull/2235, 2171 https://github.com/fmtlib/fmt/pull/2240, 2172 https://github.com/fmtlib/fmt/pull/2260, 2173 https://github.com/fmtlib/fmt/pull/2282, 2174 https://github.com/fmtlib/fmt/pull/2283, 2175 https://github.com/fmtlib/fmt/pull/2288, 2176 https://github.com/fmtlib/fmt/pull/2298, 2177 https://github.com/fmtlib/fmt/pull/2306, 2178 https://github.com/fmtlib/fmt/pull/2307, 2179 https://github.com/fmtlib/fmt/pull/2309, 2180 https://github.com/fmtlib/fmt/pull/2318, 2181 https://github.com/fmtlib/fmt/pull/2324, 2182 https://github.com/fmtlib/fmt/pull/2332, 2183 https://github.com/fmtlib/fmt/pull/2340). Thanks @DanielaE. 2184 2185- Made symbols private by default reducing shared library size 2186 (https://github.com/fmtlib/fmt/pull/2301). For example 2187 there was a \~15% reported reduction on one platform. Thanks @sergiud. 2188 2189- Optimized includes making the result of preprocessing `fmt/format.h` 2190 \~20% smaller with libstdc++/C++20 and slightly improving build 2191 times (https://github.com/fmtlib/fmt/issues/1998). 2192 2193- Added support of ranges with non-const `begin` / `end` 2194 (https://github.com/fmtlib/fmt/pull/1953). Thanks @kitegi. 2195 2196- Added support of `std::byte` and other formattable types to 2197 `fmt::join` (https://github.com/fmtlib/fmt/issues/1981, 2198 https://github.com/fmtlib/fmt/issues/2040, 2199 https://github.com/fmtlib/fmt/pull/2050, 2200 https://github.com/fmtlib/fmt/issues/2262). For example: 2201 2202 ```c++ 2203 #include <fmt/format.h> 2204 #include <cstddef> 2205 #include <vector> 2206 2207 int main() { 2208 auto bytes = std::vector{std::byte(4), std::byte(2)}; 2209 fmt::print("{}", fmt::join(bytes, "")); 2210 } 2211 ``` 2212 2213 prints \"42\". 2214 2215 Thanks @kamibo. 2216 2217- Implemented the default format for `std::chrono::system_clock` 2218 (https://github.com/fmtlib/fmt/issues/2319, 2219 https://github.com/fmtlib/fmt/pull/2345). For example: 2220 2221 ```c++ 2222 #include <fmt/chrono.h> 2223 2224 int main() { 2225 fmt::print("{}", std::chrono::system_clock::now()); 2226 } 2227 ``` 2228 2229 prints \"2021-06-18 15:22:00\" (the output depends on the current 2230 date and time). Thanks @sunmy2019. 2231 2232- Made more chrono specifiers locale independent by default. Use the 2233 `'L'` specifier to get localized formatting. For example: 2234 2235 ```c++ 2236 #include <fmt/chrono.h> 2237 2238 int main() { 2239 std::locale::global(std::locale("ru_RU.UTF-8")); 2240 auto monday = std::chrono::weekday(1); 2241 fmt::print("{}\n", monday); // prints "Mon" 2242 fmt::print("{:L}\n", monday); // prints "пн" 2243 } 2244 ``` 2245 2246- Improved locale handling in chrono formatting 2247 (https://github.com/fmtlib/fmt/issues/2337, 2248 https://github.com/fmtlib/fmt/pull/2349, 2249 https://github.com/fmtlib/fmt/pull/2350). Thanks @phprus. 2250 2251- Deprecated `fmt/locale.h` moving the formatting functions that take 2252 a locale to `fmt/format.h` (`char`) and `fmt/xchar` (other 2253 overloads). This doesn\'t introduce a dependency on `<locale>` so 2254 there is virtually no compile time effect. 2255 2256- Deprecated an undocumented `format_to` overload that takes 2257 `basic_memory_buffer`. 2258 2259- Made parameter order in `vformat_to` consistent with `format_to` 2260 (https://github.com/fmtlib/fmt/issues/2327). 2261 2262- Added support for time points with arbitrary durations 2263 (https://github.com/fmtlib/fmt/issues/2208). For example: 2264 2265 ```c++ 2266 #include <fmt/chrono.h> 2267 2268 int main() { 2269 using tp = std::chrono::time_point< 2270 std::chrono::system_clock, std::chrono::seconds>; 2271 fmt::print("{:%S}", tp(std::chrono::seconds(42))); 2272 } 2273 ``` 2274 2275 prints \"42\". 2276 2277- Formatting floating-point numbers no longer produces trailing zeros 2278 by default for consistency with `std::format`. For example: 2279 2280 ```c++ 2281 #include <fmt/core.h> 2282 2283 int main() { 2284 fmt::print("{0:.3}", 1.1); 2285 } 2286 ``` 2287 2288 prints \"1.1\". Use the `'#'` specifier to keep trailing zeros. 2289 2290- Dropped a limit on the number of elements in a range and replaced 2291 `{}` with `[]` as range delimiters for consistency with Python\'s 2292 `str.format`. 2293 2294- The `'L'` specifier for locale-specific numeric formatting can now 2295 be combined with presentation specifiers as in `std::format`. For 2296 example: 2297 2298 ```c++ 2299 #include <fmt/core.h> 2300 #include <locale> 2301 2302 int main() { 2303 std::locale::global(std::locale("fr_FR.UTF-8")); 2304 fmt::print("{0:.2Lf}", 0.42); 2305 } 2306 ``` 2307 2308 prints \"0,42\". The deprecated `'n'` specifier has been removed. 2309 2310- Made the `0` specifier ignored for infinity and NaN 2311 (https://github.com/fmtlib/fmt/issues/2305, 2312 https://github.com/fmtlib/fmt/pull/2310). Thanks @Liedtke. 2313 2314- Made the hexfloat formatting use the right alignment by default 2315 (https://github.com/fmtlib/fmt/issues/2308, 2316 https://github.com/fmtlib/fmt/pull/2317). Thanks @Liedtke. 2317 2318- Removed the deprecated numeric alignment (`'='`). Use the `'0'` 2319 specifier instead. 2320 2321- Removed the deprecated `fmt/posix.h` header that has been replaced 2322 with `fmt/os.h`. 2323 2324- Removed the deprecated `format_to_n_context`, `format_to_n_args` and 2325 `make_format_to_n_args`. They have been replaced with 2326 `format_context`, `` format_args` and ``make_format_args\`\` 2327 respectively. 2328 2329- Moved `wchar_t`-specific functions and types to `fmt/xchar.h`. You 2330 can define `FMT_DEPRECATED_INCLUDE_XCHAR` to automatically include 2331 `fmt/xchar.h` from `fmt/format.h` but this will be disabled in the 2332 next major release. 2333 2334- Fixed handling of the `'+'` specifier in localized formatting 2335 (https://github.com/fmtlib/fmt/issues/2133). 2336 2337- Added support for the `'s'` format specifier that gives textual 2338 representation of `bool` 2339 (https://github.com/fmtlib/fmt/issues/2094, 2340 https://github.com/fmtlib/fmt/pull/2109). For example: 2341 2342 ```c++ 2343 #include <fmt/core.h> 2344 2345 int main() { 2346 fmt::print("{:s}", true); 2347 } 2348 ``` 2349 2350 prints \"true\". Thanks @powercoderlol. 2351 2352- Made `fmt::ptr` work with function pointers 2353 (https://github.com/fmtlib/fmt/pull/2131). For example: 2354 2355 ```c++ 2356 #include <fmt/format.h> 2357 2358 int main() { 2359 fmt::print("My main: {}\n", fmt::ptr(main)); 2360 } 2361 ``` 2362 2363 Thanks @mikecrowe. 2364 2365- The undocumented support for specializing `formatter` for pointer 2366 types has been removed. 2367 2368- Fixed `fmt::formatted_size` with format string compilation 2369 (https://github.com/fmtlib/fmt/pull/2141, 2370 https://github.com/fmtlib/fmt/pull/2161). Thanks @alexezeder. 2371 2372- Fixed handling of empty format strings during format string 2373 compilation (https://github.com/fmtlib/fmt/issues/2042): 2374 2375 ```c++ 2376 auto s = fmt::format(FMT_COMPILE("")); 2377 ``` 2378 2379 Thanks @alexezeder. 2380 2381- Fixed handling of enums in `fmt::to_string` 2382 (https://github.com/fmtlib/fmt/issues/2036). 2383 2384- Improved width computation 2385 (https://github.com/fmtlib/fmt/issues/2033, 2386 https://github.com/fmtlib/fmt/issues/2091). For example: 2387 2388 ```c++ 2389 #include <fmt/core.h> 2390 2391 int main() { 2392 fmt::print("{:-<10}{}\n", "你好", "世界"); 2393 fmt::print("{:-<10}{}\n", "hello", "world"); 2394 } 2395 ``` 2396 2397 prints 2398 2399  2400 2401 on a modern terminal. 2402 2403- The experimental fast output stream (`fmt::ostream`) is now 2404 truncated by default for consistency with `fopen` 2405 (https://github.com/fmtlib/fmt/issues/2018). For example: 2406 2407 ```c++ 2408 #include <fmt/os.h> 2409 2410 int main() { 2411 fmt::ostream out1 = fmt::output_file("guide"); 2412 out1.print("Zaphod"); 2413 out1.close(); 2414 fmt::ostream out2 = fmt::output_file("guide"); 2415 out2.print("Ford"); 2416 } 2417 ``` 2418 2419 writes \"Ford\" to the file \"guide\". To preserve the old file 2420 content if any pass `fmt::file::WRONLY | fmt::file::CREATE` flags to 2421 `fmt::output_file`. 2422 2423- Fixed moving of `fmt::ostream` that holds buffered data 2424 (https://github.com/fmtlib/fmt/issues/2197, 2425 https://github.com/fmtlib/fmt/pull/2198). Thanks @vtta. 2426 2427- Replaced the `fmt::system_error` exception with a function of the 2428 same name that constructs `std::system_error` 2429 (https://github.com/fmtlib/fmt/issues/2266). 2430 2431- Replaced the `fmt::windows_error` exception with a function of the 2432 same name that constructs `std::system_error` with the category 2433 returned by `fmt::system_category()` 2434 (https://github.com/fmtlib/fmt/issues/2274, 2435 https://github.com/fmtlib/fmt/pull/2275). The latter is 2436 similar to `std::system_category` but correctly handles UTF-8. 2437 Thanks @phprus. 2438 2439- Replaced `fmt::error_code` with `std::error_code` and made it 2440 formattable (https://github.com/fmtlib/fmt/issues/2269, 2441 https://github.com/fmtlib/fmt/pull/2270, 2442 https://github.com/fmtlib/fmt/pull/2273). Thanks @phprus. 2443 2444- Added speech synthesis support 2445 (https://github.com/fmtlib/fmt/pull/2206). 2446 2447- Made `format_to` work with a memory buffer that has a custom 2448 allocator (https://github.com/fmtlib/fmt/pull/2300). 2449 Thanks @voxmea. 2450 2451- Added `Allocator::max_size` support to `basic_memory_buffer`. 2452 (https://github.com/fmtlib/fmt/pull/1960). Thanks @phprus. 2453 2454- Added wide string support to `fmt::join` 2455 (https://github.com/fmtlib/fmt/pull/2236). Thanks @crbrz. 2456 2457- Made iterators passed to `formatter` specializations via a format 2458 context satisfy C++20 `std::output_iterator` requirements 2459 (https://github.com/fmtlib/fmt/issues/2156, 2460 https://github.com/fmtlib/fmt/pull/2158, 2461 https://github.com/fmtlib/fmt/issues/2195, 2462 https://github.com/fmtlib/fmt/pull/2204). Thanks @randomnetcat. 2463 2464- Optimized the `printf` implementation 2465 (https://github.com/fmtlib/fmt/pull/1982, 2466 https://github.com/fmtlib/fmt/pull/1984, 2467 https://github.com/fmtlib/fmt/pull/2016, 2468 https://github.com/fmtlib/fmt/pull/2164). 2469 Thanks @rimathia and @moiwi. 2470 2471- Improved detection of `constexpr` `char_traits` 2472 (https://github.com/fmtlib/fmt/pull/2246, 2473 https://github.com/fmtlib/fmt/pull/2257). Thanks @phprus. 2474 2475- Fixed writing to `stdout` when it is redirected to `NUL` on Windows 2476 (https://github.com/fmtlib/fmt/issues/2080). 2477 2478- Fixed exception propagation from iterators 2479 (https://github.com/fmtlib/fmt/issues/2097). 2480 2481- Improved `strftime` error handling 2482 (https://github.com/fmtlib/fmt/issues/2238, 2483 https://github.com/fmtlib/fmt/pull/2244). Thanks @yumeyao. 2484 2485- Stopped using deprecated GCC UDL template extension. 2486 2487- Added `fmt/args.h` to the install target 2488 (https://github.com/fmtlib/fmt/issues/2096). 2489 2490- Error messages are now passed to assert when exceptions are disabled 2491 (https://github.com/fmtlib/fmt/pull/2145). Thanks @NobodyXu. 2492 2493- Added the `FMT_MASTER_PROJECT` CMake option to control build and 2494 install targets when {fmt} is included via `add_subdirectory` 2495 (https://github.com/fmtlib/fmt/issues/2098, 2496 https://github.com/fmtlib/fmt/pull/2100). 2497 Thanks @randomizedthinking. 2498 2499- Improved build configuration 2500 (https://github.com/fmtlib/fmt/pull/2026, 2501 https://github.com/fmtlib/fmt/pull/2122). 2502 Thanks @luncliff and @ibaned. 2503 2504- Fixed various warnings and compilation issues 2505 (https://github.com/fmtlib/fmt/issues/1947, 2506 https://github.com/fmtlib/fmt/pull/1959, 2507 https://github.com/fmtlib/fmt/pull/1963, 2508 https://github.com/fmtlib/fmt/pull/1965, 2509 https://github.com/fmtlib/fmt/issues/1966, 2510 https://github.com/fmtlib/fmt/pull/1974, 2511 https://github.com/fmtlib/fmt/pull/1975, 2512 https://github.com/fmtlib/fmt/pull/1990, 2513 https://github.com/fmtlib/fmt/issues/2000, 2514 https://github.com/fmtlib/fmt/pull/2001, 2515 https://github.com/fmtlib/fmt/issues/2002, 2516 https://github.com/fmtlib/fmt/issues/2004, 2517 https://github.com/fmtlib/fmt/pull/2006, 2518 https://github.com/fmtlib/fmt/pull/2009, 2519 https://github.com/fmtlib/fmt/pull/2010, 2520 https://github.com/fmtlib/fmt/issues/2038, 2521 https://github.com/fmtlib/fmt/issues/2039, 2522 https://github.com/fmtlib/fmt/issues/2047, 2523 https://github.com/fmtlib/fmt/pull/2053, 2524 https://github.com/fmtlib/fmt/issues/2059, 2525 https://github.com/fmtlib/fmt/pull/2065, 2526 https://github.com/fmtlib/fmt/pull/2067, 2527 https://github.com/fmtlib/fmt/pull/2068, 2528 https://github.com/fmtlib/fmt/pull/2073, 2529 https://github.com/fmtlib/fmt/issues/2103, 2530 https://github.com/fmtlib/fmt/issues/2105, 2531 https://github.com/fmtlib/fmt/pull/2106, 2532 https://github.com/fmtlib/fmt/pull/2107, 2533 https://github.com/fmtlib/fmt/issues/2116, 2534 https://github.com/fmtlib/fmt/pull/2117, 2535 https://github.com/fmtlib/fmt/issues/2118, 2536 https://github.com/fmtlib/fmt/pull/2119, 2537 https://github.com/fmtlib/fmt/issues/2127, 2538 https://github.com/fmtlib/fmt/pull/2128, 2539 https://github.com/fmtlib/fmt/issues/2140, 2540 https://github.com/fmtlib/fmt/issues/2142, 2541 https://github.com/fmtlib/fmt/pull/2143, 2542 https://github.com/fmtlib/fmt/pull/2144, 2543 https://github.com/fmtlib/fmt/issues/2147, 2544 https://github.com/fmtlib/fmt/issues/2148, 2545 https://github.com/fmtlib/fmt/issues/2149, 2546 https://github.com/fmtlib/fmt/pull/2152, 2547 https://github.com/fmtlib/fmt/pull/2160, 2548 https://github.com/fmtlib/fmt/issues/2170, 2549 https://github.com/fmtlib/fmt/issues/2175, 2550 https://github.com/fmtlib/fmt/issues/2176, 2551 https://github.com/fmtlib/fmt/pull/2177, 2552 https://github.com/fmtlib/fmt/issues/2178, 2553 https://github.com/fmtlib/fmt/pull/2179, 2554 https://github.com/fmtlib/fmt/issues/2180, 2555 https://github.com/fmtlib/fmt/issues/2181, 2556 https://github.com/fmtlib/fmt/pull/2183, 2557 https://github.com/fmtlib/fmt/issues/2184, 2558 https://github.com/fmtlib/fmt/issues/2185, 2559 https://github.com/fmtlib/fmt/pull/2186, 2560 https://github.com/fmtlib/fmt/pull/2187, 2561 https://github.com/fmtlib/fmt/pull/2190, 2562 https://github.com/fmtlib/fmt/pull/2192, 2563 https://github.com/fmtlib/fmt/pull/2194, 2564 https://github.com/fmtlib/fmt/pull/2205, 2565 https://github.com/fmtlib/fmt/issues/2210, 2566 https://github.com/fmtlib/fmt/pull/2211, 2567 https://github.com/fmtlib/fmt/pull/2215, 2568 https://github.com/fmtlib/fmt/pull/2216, 2569 https://github.com/fmtlib/fmt/pull/2218, 2570 https://github.com/fmtlib/fmt/pull/2220, 2571 https://github.com/fmtlib/fmt/issues/2228, 2572 https://github.com/fmtlib/fmt/pull/2229, 2573 https://github.com/fmtlib/fmt/pull/2230, 2574 https://github.com/fmtlib/fmt/issues/2233, 2575 https://github.com/fmtlib/fmt/pull/2239, 2576 https://github.com/fmtlib/fmt/issues/2248, 2577 https://github.com/fmtlib/fmt/issues/2252, 2578 https://github.com/fmtlib/fmt/pull/2253, 2579 https://github.com/fmtlib/fmt/pull/2255, 2580 https://github.com/fmtlib/fmt/issues/2261, 2581 https://github.com/fmtlib/fmt/issues/2278, 2582 https://github.com/fmtlib/fmt/issues/2284, 2583 https://github.com/fmtlib/fmt/pull/2287, 2584 https://github.com/fmtlib/fmt/pull/2289, 2585 https://github.com/fmtlib/fmt/pull/2290, 2586 https://github.com/fmtlib/fmt/pull/2293, 2587 https://github.com/fmtlib/fmt/issues/2295, 2588 https://github.com/fmtlib/fmt/pull/2296, 2589 https://github.com/fmtlib/fmt/pull/2297, 2590 https://github.com/fmtlib/fmt/issues/2311, 2591 https://github.com/fmtlib/fmt/pull/2313, 2592 https://github.com/fmtlib/fmt/pull/2315, 2593 https://github.com/fmtlib/fmt/issues/2320, 2594 https://github.com/fmtlib/fmt/pull/2321, 2595 https://github.com/fmtlib/fmt/pull/2323, 2596 https://github.com/fmtlib/fmt/issues/2328, 2597 https://github.com/fmtlib/fmt/pull/2329, 2598 https://github.com/fmtlib/fmt/pull/2333, 2599 https://github.com/fmtlib/fmt/pull/2338, 2600 https://github.com/fmtlib/fmt/pull/2341). 2601 Thanks @darklukee, @fagg, @killerbot242, @jgopel, @yeswalrus, @Finkman, 2602 @HazardyKnusperkeks, @dkavolis, @concatime, @chronoxor, @summivox, @yNeo, 2603 @Apache-HB, @alexezeder, @toojays, @Brainy0207, @vadz, @imsherlock, @phprus, 2604 @white238, @yafshar, @BillyDonahue, @jstaahl, @denchat, @DanielaE, 2605 @ilyakurdyukov, @ilmai, @JessyDL, @sergiud, @mwinterb, @sven-herrmann, 2606 @jmelas, @twoixter, @crbrz and @upsj. 2607 2608- Improved documentation 2609 (https://github.com/fmtlib/fmt/issues/1986, 2610 https://github.com/fmtlib/fmt/pull/2051, 2611 https://github.com/fmtlib/fmt/issues/2057, 2612 https://github.com/fmtlib/fmt/pull/2081, 2613 https://github.com/fmtlib/fmt/issues/2084, 2614 https://github.com/fmtlib/fmt/pull/2312). 2615 Thanks @imba-tjd, @0x416c69 and @mordante. 2616 2617- Continuous integration and test improvements 2618 (https://github.com/fmtlib/fmt/issues/1969, 2619 https://github.com/fmtlib/fmt/pull/1991, 2620 https://github.com/fmtlib/fmt/pull/2020, 2621 https://github.com/fmtlib/fmt/pull/2110, 2622 https://github.com/fmtlib/fmt/pull/2114, 2623 https://github.com/fmtlib/fmt/issues/2196, 2624 https://github.com/fmtlib/fmt/pull/2217, 2625 https://github.com/fmtlib/fmt/pull/2247, 2626 https://github.com/fmtlib/fmt/pull/2256, 2627 https://github.com/fmtlib/fmt/pull/2336, 2628 https://github.com/fmtlib/fmt/pull/2346). 2629 Thanks @jgopel, @alexezeder and @DanielaE. 2630 2631The change log for versions 0.8.0 - 7.1.3 is available [here]( 2632doc/ChangeLog-old.md). 2633