Mercurial > minori
comparison dep/fmt/ChangeLog.md @ 343:1faa72660932
*: transfer back to cmake from autotools
autotools just made lots of things more complicated than
they should have and many things broke (i.e. translations)
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Thu, 20 Jun 2024 05:56:06 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 342:adb79bdde329 | 343:1faa72660932 |
|---|---|
| 1 # 10.2.1 - 2024-01-03 | |
| 2 | |
| 3 - Fixed ABI compatibility with earlier 10.x versions | |
| 4 (https://github.com/fmtlib/fmt/pull/3786). Thanks @saraedum. | |
| 5 | |
| 6 # 10.2.0 - 2024-01-01 | |
| 7 | |
| 8 - Added support for the `%j` specifier (the number of days) for | |
| 9 `std::chrono::duration` (https://github.com/fmtlib/fmt/issues/3643, | |
| 10 https://github.com/fmtlib/fmt/pull/3732). Thanks @intelfx. | |
| 11 | |
| 12 - Added support for the chrono suffix for days and changed | |
| 13 the suffix for minutes from "m" to the correct "min" | |
| 14 (https://github.com/fmtlib/fmt/issues/3662, | |
| 15 https://github.com/fmtlib/fmt/pull/3664). | |
| 16 For example ([godbolt](https://godbolt.org/z/9KhMnq9ba)): | |
| 17 | |
| 18 ```c++ | |
| 19 #include <fmt/chrono.h> | |
| 20 | |
| 21 int main() { | |
| 22 fmt::print("{}\n", std::chrono::days(42)); // prints "42d" | |
| 23 } | |
| 24 ``` | |
| 25 | |
| 26 Thanks @Richardk2n. | |
| 27 | |
| 28 - Fixed an overflow in `std::chrono::time_point` formatting with large dates | |
| 29 (https://github.com/fmtlib/fmt/issues/3725, | |
| 30 https://github.com/fmtlib/fmt/pull/3727). Thanks @cschreib. | |
| 31 | |
| 32 - Added a formatter for `std::source_location` | |
| 33 (https://github.com/fmtlib/fmt/pull/3730). | |
| 34 For example ([godbolt](https://godbolt.org/z/YajfKjhhr)): | |
| 35 | |
| 36 ```c++ | |
| 37 #include <source_location> | |
| 38 #include <fmt/std.h> | |
| 39 | |
| 40 int main() { | |
| 41 fmt::print("{}\n", std::source_location::current()); | |
| 42 } | |
| 43 ``` | |
| 44 | |
| 45 prints | |
| 46 | |
| 47 ``` | |
| 48 /app/example.cpp:5:51: int main() | |
| 49 ``` | |
| 50 | |
| 51 Thanks @felix642. | |
| 52 | |
| 53 - Added a formatter for `std::bitset` | |
| 54 (https://github.com/fmtlib/fmt/pull/3660). | |
| 55 For example ([godbolt](https://godbolt.org/z/bdEaGeYxe)): | |
| 56 | |
| 57 ```c++ | |
| 58 #include <bitset> | |
| 59 #include <fmt/std.h> | |
| 60 | |
| 61 int main() { | |
| 62 fmt::print("{}\n", std::bitset<6>(42)); // prints "101010" | |
| 63 } | |
| 64 ``` | |
| 65 | |
| 66 Thanks @muggenhor. | |
| 67 | |
| 68 - Added an experimental `nested_formatter` that provides an easy way of | |
| 69 applying a formatter to one or more subobjects while automatically handling | |
| 70 width, fill and alignment. For example: | |
| 71 | |
| 72 ```c++ | |
| 73 #include <fmt/format.h> | |
| 74 | |
| 75 struct point { | |
| 76 double x, y; | |
| 77 }; | |
| 78 | |
| 79 template <> | |
| 80 struct fmt::formatter<point> : nested_formatter<double> { | |
| 81 auto format(point p, format_context& ctx) const { | |
| 82 return write_padded(ctx, [=](auto out) { | |
| 83 return format_to(out, "({}, {})", nested(p.x), nested(p.y)); | |
| 84 }); | |
| 85 } | |
| 86 }; | |
| 87 | |
| 88 int main() { | |
| 89 fmt::print("[{:>20.2f}]", point{1, 2}); | |
| 90 } | |
| 91 ``` | |
| 92 | |
| 93 prints | |
| 94 | |
| 95 ``` | |
| 96 [ (1.00, 2.00)] | |
| 97 ``` | |
| 98 | |
| 99 - Added the generic representation (`g`) to `std::filesystem::path` | |
| 100 (https://github.com/fmtlib/fmt/issues/3715, | |
| 101 https://github.com/fmtlib/fmt/pull/3729). For example: | |
| 102 | |
| 103 ```c++ | |
| 104 #include <filesystem> | |
| 105 #include <fmt/std.h> | |
| 106 | |
| 107 int main() { | |
| 108 fmt::print("{:g}\n", std::filesystem::path("C:\\foo")); | |
| 109 } | |
| 110 ``` | |
| 111 | |
| 112 prints `"C:/foo"` on Windows. | |
| 113 | |
| 114 Thanks @js324. | |
| 115 | |
| 116 - Made `format_as` work with references | |
| 117 (https://github.com/fmtlib/fmt/pull/3739). Thanks @tchaikov. | |
| 118 | |
| 119 - Fixed formatting of invalid UTF-8 with precision | |
| 120 (https://github.com/fmtlib/fmt/issues/3284). | |
| 121 | |
| 122 - Fixed an inconsistency between `fmt::to_string` and `fmt::format` | |
| 123 (https://github.com/fmtlib/fmt/issues/3684). | |
| 124 | |
| 125 - Disallowed unsafe uses of `fmt::styled` | |
| 126 (https://github.com/fmtlib/fmt/issues/3625): | |
| 127 | |
| 128 ```c++ | |
| 129 auto s = fmt::styled(std::string("dangle"), fmt::emphasis::bold); | |
| 130 fmt::print("{}\n", s); // compile error | |
| 131 ``` | |
| 132 | |
| 133 Pass `fmt::styled(...)` as a parameter instead. | |
| 134 | |
| 135 - Added a null check when formatting a C string with the `s` specifier | |
| 136 (https://github.com/fmtlib/fmt/issues/3706). | |
| 137 | |
| 138 - Disallowed the `c` specifier for `bool` | |
| 139 (https://github.com/fmtlib/fmt/issues/3726, | |
| 140 https://github.com/fmtlib/fmt/pull/3734). Thanks @js324. | |
| 141 | |
| 142 - Made the default formatting unlocalized in `fmt::ostream_formatter` for | |
| 143 consistency with the rest of the library | |
| 144 (https://github.com/fmtlib/fmt/issues/3460). | |
| 145 | |
| 146 - Fixed localized formatting in bases other than decimal | |
| 147 (https://github.com/fmtlib/fmt/issues/3693, | |
| 148 https://github.com/fmtlib/fmt/pull/3750). Thanks @js324. | |
| 149 | |
| 150 - Fixed a performance regression in experimental `fmt::ostream::print` | |
| 151 (https://github.com/fmtlib/fmt/issues/3674). | |
| 152 | |
| 153 - Added synchronization with the underlying output stream when writing to | |
| 154 the Windows console | |
| 155 (https://github.com/fmtlib/fmt/pull/3668, | |
| 156 https://github.com/fmtlib/fmt/issues/3688, | |
| 157 https://github.com/fmtlib/fmt/pull/3689). | |
| 158 Thanks @Roman-Koshelev and @dimztimz. | |
| 159 | |
| 160 - Changed to only export `format_error` when {fmt} is built as a shared | |
| 161 library (https://github.com/fmtlib/fmt/issues/3626, | |
| 162 https://github.com/fmtlib/fmt/pull/3627). Thanks @phprus. | |
| 163 | |
| 164 - Made `fmt::streamed` `constexpr`. | |
| 165 (https://github.com/fmtlib/fmt/pull/3650). Thanks @muggenhor. | |
| 166 | |
| 167 - Enabled `consteval` on older versions of MSVC | |
| 168 (https://github.com/fmtlib/fmt/pull/3757). Thanks @phprus. | |
| 169 | |
| 170 - Added an option to build without `wchar_t` support on Windows | |
| 171 (https://github.com/fmtlib/fmt/issues/3631, | |
| 172 https://github.com/fmtlib/fmt/pull/3636). Thanks @glebm. | |
| 173 | |
| 174 - Improved build and CI configuration | |
| 175 (https://github.com/fmtlib/fmt/pull/3679, | |
| 176 https://github.com/fmtlib/fmt/issues/3701, | |
| 177 https://github.com/fmtlib/fmt/pull/3702, | |
| 178 https://github.com/fmtlib/fmt/pull/3749). | |
| 179 Thanks @jcar87, @pklima and @tchaikov. | |
| 180 | |
| 181 - Fixed various warnings, compilation and test issues | |
| 182 (https://github.com/fmtlib/fmt/issues/3607, | |
| 183 https://github.com/fmtlib/fmt/pull/3610, | |
| 184 https://github.com/fmtlib/fmt/pull/3624, | |
| 185 https://github.com/fmtlib/fmt/pull/3630, | |
| 186 https://github.com/fmtlib/fmt/pull/3634, | |
| 187 https://github.com/fmtlib/fmt/pull/3638, | |
| 188 https://github.com/fmtlib/fmt/issues/3645, | |
| 189 https://github.com/fmtlib/fmt/issues/3646, | |
| 190 https://github.com/fmtlib/fmt/pull/3647, | |
| 191 https://github.com/fmtlib/fmt/pull/3652, | |
| 192 https://github.com/fmtlib/fmt/issues/3654, | |
| 193 https://github.com/fmtlib/fmt/pull/3663, | |
| 194 https://github.com/fmtlib/fmt/issues/3670, | |
| 195 https://github.com/fmtlib/fmt/pull/3680, | |
| 196 https://github.com/fmtlib/fmt/issues/3694, | |
| 197 https://github.com/fmtlib/fmt/pull/3695, | |
| 198 https://github.com/fmtlib/fmt/pull/3699, | |
| 199 https://github.com/fmtlib/fmt/issues/3705, | |
| 200 https://github.com/fmtlib/fmt/issues/3710, | |
| 201 https://github.com/fmtlib/fmt/issues/3712, | |
| 202 https://github.com/fmtlib/fmt/pull/3713, | |
| 203 https://github.com/fmtlib/fmt/issues/3714, | |
| 204 https://github.com/fmtlib/fmt/pull/3716, | |
| 205 https://github.com/fmtlib/fmt/pull/3723, | |
| 206 https://github.com/fmtlib/fmt/issues/3738, | |
| 207 https://github.com/fmtlib/fmt/issues/3740, | |
| 208 https://github.com/fmtlib/fmt/pull/3741, | |
| 209 https://github.com/fmtlib/fmt/pull/3743, | |
| 210 https://github.com/fmtlib/fmt/issues/3745, | |
| 211 https://github.com/fmtlib/fmt/pull/3747, | |
| 212 https://github.com/fmtlib/fmt/pull/3748, | |
| 213 https://github.com/fmtlib/fmt/pull/3751, | |
| 214 https://github.com/fmtlib/fmt/pull/3754, | |
| 215 https://github.com/fmtlib/fmt/pull/3755, | |
| 216 https://github.com/fmtlib/fmt/issues/3760, | |
| 217 https://github.com/fmtlib/fmt/pull/3762, | |
| 218 https://github.com/fmtlib/fmt/issues/3763, | |
| 219 https://github.com/fmtlib/fmt/pull/3764, | |
| 220 https://github.com/fmtlib/fmt/issues/3774, | |
| 221 https://github.com/fmtlib/fmt/pull/3779). | |
| 222 Thanks @danakj, @vinayyadav3016, @cyyever, @phprus, @qimiko, @saschasc, | |
| 223 @gsjaardema, @lazka, @Zhaojun-Liu, @carlsmedstad, @hotwatermorning, | |
| 224 @cptFracassa, @kuguma, @PeterJohnson, @H1X4Dev, @asantoni, @eltociear, | |
| 225 @msimberg, @tchaikov, @waywardmonkeys. | |
| 226 | |
| 227 - Improved documentation and README | |
| 228 (https://github.com/fmtlib/fmt/issues/2086, | |
| 229 https://github.com/fmtlib/fmt/issues/3637, | |
| 230 https://github.com/fmtlib/fmt/pull/3642, | |
| 231 https://github.com/fmtlib/fmt/pull/3653, | |
| 232 https://github.com/fmtlib/fmt/pull/3655, | |
| 233 https://github.com/fmtlib/fmt/pull/3661, | |
| 234 https://github.com/fmtlib/fmt/issues/3673, | |
| 235 https://github.com/fmtlib/fmt/pull/3677, | |
| 236 https://github.com/fmtlib/fmt/pull/3737, | |
| 237 https://github.com/fmtlib/fmt/issues/3742, | |
| 238 https://github.com/fmtlib/fmt/pull/3744). | |
| 239 Thanks @idzm, @perlun, @joycebrum, @fennewald, @reinhardt1053, @GeorgeLS. | |
| 240 | |
| 241 - Updated CI dependencies | |
| 242 (https://github.com/fmtlib/fmt/pull/3615, | |
| 243 https://github.com/fmtlib/fmt/pull/3622, | |
| 244 https://github.com/fmtlib/fmt/pull/3623, | |
| 245 https://github.com/fmtlib/fmt/pull/3666, | |
| 246 https://github.com/fmtlib/fmt/pull/3696, | |
| 247 https://github.com/fmtlib/fmt/pull/3697, | |
| 248 https://github.com/fmtlib/fmt/pull/3759, | |
| 249 https://github.com/fmtlib/fmt/pull/3782). | |
| 250 | |
| 251 # 10.1.1 - 2023-08-28 | |
| 252 | |
| 253 - Added formatters for `std::atomic` and `atomic_flag` | |
| 254 (https://github.com/fmtlib/fmt/pull/3574, | |
| 255 https://github.com/fmtlib/fmt/pull/3594). | |
| 256 Thanks @wangzw and @AlexGuteniev. | |
| 257 - Fixed an error about partial specialization of `formatter<string>` | |
| 258 after instantiation when compiled with gcc and C++20 | |
| 259 (https://github.com/fmtlib/fmt/issues/3584). | |
| 260 - Fixed compilation as a C++20 module with gcc and clang | |
| 261 (https://github.com/fmtlib/fmt/issues/3587, | |
| 262 https://github.com/fmtlib/fmt/pull/3597, | |
| 263 https://github.com/fmtlib/fmt/pull/3605). | |
| 264 Thanks @MathewBensonCode. | |
| 265 - Made `fmt::to_string` work with types that have `format_as` | |
| 266 overloads (https://github.com/fmtlib/fmt/pull/3575). Thanks @phprus. | |
| 267 - Made `formatted_size` work with integral format specifiers at | |
| 268 compile time (https://github.com/fmtlib/fmt/pull/3591). | |
| 269 Thanks @elbeno. | |
| 270 - Fixed a warning about the `no_unique_address` attribute on clang-cl | |
| 271 (https://github.com/fmtlib/fmt/pull/3599). Thanks @lukester1975. | |
| 272 - Improved compatibility with the legacy GBK encoding | |
| 273 (https://github.com/fmtlib/fmt/issues/3598, | |
| 274 https://github.com/fmtlib/fmt/pull/3599). Thanks @YuHuanTin. | |
| 275 - Added OpenSSF Scorecard analysis | |
| 276 (https://github.com/fmtlib/fmt/issues/3530, | |
| 277 https://github.com/fmtlib/fmt/pull/3571). Thanks @joycebrum. | |
| 278 - Updated CI dependencies | |
| 279 (https://github.com/fmtlib/fmt/pull/3591, | |
| 280 https://github.com/fmtlib/fmt/pull/3592, | |
| 281 https://github.com/fmtlib/fmt/pull/3593, | |
| 282 https://github.com/fmtlib/fmt/pull/3602). | |
| 283 | |
| 284 # 10.1.0 - 2023-08-12 | |
| 285 | |
| 286 - Optimized format string compilation resulting in up to 40% speed up | |
| 287 in compiled `format_to` and \~4x speed up in compiled `format_to_n` | |
| 288 on a concatenation benchmark | |
| 289 (https://github.com/fmtlib/fmt/issues/3133, | |
| 290 https://github.com/fmtlib/fmt/issues/3484). | |
| 291 | |
| 292 {fmt} 10.0: | |
| 293 | |
| 294 --------------------------------------------------------- | |
| 295 Benchmark Time CPU Iterations | |
| 296 --------------------------------------------------------- | |
| 297 BM_format_to 78.9 ns 78.9 ns 8881746 | |
| 298 BM_format_to_n 568 ns 568 ns 1232089 | |
| 299 | |
| 300 {fmt} 10.1: | |
| 301 | |
| 302 --------------------------------------------------------- | |
| 303 Benchmark Time CPU Iterations | |
| 304 --------------------------------------------------------- | |
| 305 BM_format_to 54.9 ns 54.9 ns 12727944 | |
| 306 BM_format_to_n 133 ns 133 ns 5257795 | |
| 307 | |
| 308 - Optimized storage of an empty allocator in `basic_memory_buffer` | |
| 309 (https://github.com/fmtlib/fmt/pull/3485). Thanks @Minty-Meeo. | |
| 310 | |
| 311 - Added formatters for proxy references to elements of | |
| 312 `std::vector<bool>` and `std::bitset<N>` | |
| 313 (https://github.com/fmtlib/fmt/issues/3567, | |
| 314 https://github.com/fmtlib/fmt/pull/3570). For example | |
| 315 ([godbolt](https://godbolt.org/z/zYb79Pvn8)): | |
| 316 | |
| 317 ```c++ | |
| 318 #include <vector> | |
| 319 #include <fmt/std.h> | |
| 320 | |
| 321 int main() { | |
| 322 auto v = std::vector<bool>{true}; | |
| 323 fmt::print("{}", v[0]); | |
| 324 } | |
| 325 ``` | |
| 326 | |
| 327 Thanks @phprus and @felix642. | |
| 328 | |
| 329 - Fixed an ambiguous formatter specialization for containers that look | |
| 330 like container adaptors such as `boost::flat_set` | |
| 331 (https://github.com/fmtlib/fmt/issues/3556, | |
| 332 https://github.com/fmtlib/fmt/pull/3561). Thanks @5chmidti. | |
| 333 | |
| 334 - Fixed compilation when formatting durations not convertible from | |
| 335 `std::chrono::seconds` | |
| 336 (https://github.com/fmtlib/fmt/pull/3430). Thanks @patlkli. | |
| 337 | |
| 338 - Made the `formatter` specialization for `char*` const-correct | |
| 339 (https://github.com/fmtlib/fmt/pull/3432). Thanks @timsong-cpp. | |
| 340 | |
| 341 - Made `{}` and `{:}` handled consistently during compile-time checks | |
| 342 (https://github.com/fmtlib/fmt/issues/3526). | |
| 343 | |
| 344 - Disallowed passing temporaries to `make_format_args` to improve API | |
| 345 safety by preventing dangling references. | |
| 346 | |
| 347 - Improved the compile-time error for unformattable types | |
| 348 (https://github.com/fmtlib/fmt/pull/3478). Thanks @BRevzin. | |
| 349 | |
| 350 - Improved the floating-point formatter | |
| 351 (https://github.com/fmtlib/fmt/pull/3448, | |
| 352 https://github.com/fmtlib/fmt/pull/3450). | |
| 353 Thanks @florimond-collette. | |
| 354 | |
| 355 - Fixed handling of precision for `long double` larger than 64 bits. | |
| 356 (https://github.com/fmtlib/fmt/issues/3539, | |
| 357 https://github.com/fmtlib/fmt/issues/3564). | |
| 358 | |
| 359 - Made floating-point and chrono tests less platform-dependent | |
| 360 (https://github.com/fmtlib/fmt/issues/3337, | |
| 361 https://github.com/fmtlib/fmt/issues/3433, | |
| 362 https://github.com/fmtlib/fmt/pull/3434). Thanks @phprus. | |
| 363 | |
| 364 - Removed the remnants of the Grisu floating-point formatter that has | |
| 365 been replaced by Dragonbox in earlier versions. | |
| 366 | |
| 367 - Added `throw_format_error` to the public API | |
| 368 (https://github.com/fmtlib/fmt/pull/3551). Thanks @mjerabek. | |
| 369 | |
| 370 - Made `FMT_THROW` assert even if assertions are disabled when | |
| 371 compiling with exceptions disabled | |
| 372 (https://github.com/fmtlib/fmt/issues/3418, | |
| 373 https://github.com/fmtlib/fmt/pull/3439). Thanks @BRevzin. | |
| 374 | |
| 375 - Made `format_as` and `std::filesystem::path` formatter work with | |
| 376 exotic code unit types. | |
| 377 (https://github.com/fmtlib/fmt/pull/3457, | |
| 378 https://github.com/fmtlib/fmt/pull/3476). Thanks @gix and @hmbj. | |
| 379 | |
| 380 - Added support for the `?` format specifier to | |
| 381 `std::filesystem::path` and made the default unescaped for | |
| 382 consistency with strings. | |
| 383 | |
| 384 - Deprecated the wide stream overload of `printf`. | |
| 385 | |
| 386 - Removed unused `basic_printf_parse_context`. | |
| 387 | |
| 388 - Improved RTTI detection used when formatting exceptions | |
| 389 (https://github.com/fmtlib/fmt/pull/3468). Thanks @danakj. | |
| 390 | |
| 391 - Improved compatibility with VxWorks7 | |
| 392 (https://github.com/fmtlib/fmt/pull/3467). Thanks @wenshan1. | |
| 393 | |
| 394 - Improved documentation | |
| 395 (https://github.com/fmtlib/fmt/issues/3174, | |
| 396 https://github.com/fmtlib/fmt/issues/3423, | |
| 397 https://github.com/fmtlib/fmt/pull/3454, | |
| 398 https://github.com/fmtlib/fmt/issues/3458, | |
| 399 https://github.com/fmtlib/fmt/pull/3461, | |
| 400 https://github.com/fmtlib/fmt/issues/3487, | |
| 401 https://github.com/fmtlib/fmt/pull/3515). | |
| 402 Thanks @zencatalyst, @rlalik and @mikecrowe. | |
| 403 | |
| 404 - Improved build and CI configurations | |
| 405 (https://github.com/fmtlib/fmt/issues/3449, | |
| 406 https://github.com/fmtlib/fmt/pull/3451, | |
| 407 https://github.com/fmtlib/fmt/pull/3452, | |
| 408 https://github.com/fmtlib/fmt/pull/3453, | |
| 409 https://github.com/fmtlib/fmt/pull/3459, | |
| 410 https://github.com/fmtlib/fmt/issues/3481, | |
| 411 https://github.com/fmtlib/fmt/pull/3486, | |
| 412 https://github.com/fmtlib/fmt/issues/3489, | |
| 413 https://github.com/fmtlib/fmt/pull/3496, | |
| 414 https://github.com/fmtlib/fmt/issues/3517, | |
| 415 https://github.com/fmtlib/fmt/pull/3523, | |
| 416 https://github.com/fmtlib/fmt/pull/3563). | |
| 417 Thanks @joycebrum, @glebm, @phprus, @petrmanek, @setoye and @abouvier. | |
| 418 | |
| 419 - Fixed various warnings and compilation issues | |
| 420 (https://github.com/fmtlib/fmt/issues/3408, | |
| 421 https://github.com/fmtlib/fmt/issues/3424, | |
| 422 https://github.com/fmtlib/fmt/issues/3444, | |
| 423 https://github.com/fmtlib/fmt/pull/3446, | |
| 424 https://github.com/fmtlib/fmt/pull/3475, | |
| 425 https://github.com/fmtlib/fmt/pull/3482, | |
| 426 https://github.com/fmtlib/fmt/issues/3492, | |
| 427 https://github.com/fmtlib/fmt/pull/3493, | |
| 428 https://github.com/fmtlib/fmt/pull/3508, | |
| 429 https://github.com/fmtlib/fmt/issues/3509, | |
| 430 https://github.com/fmtlib/fmt/issues/3533, | |
| 431 https://github.com/fmtlib/fmt/pull/3542, | |
| 432 https://github.com/fmtlib/fmt/issues/3543, | |
| 433 https://github.com/fmtlib/fmt/issues/3540, | |
| 434 https://github.com/fmtlib/fmt/pull/3544, | |
| 435 https://github.com/fmtlib/fmt/issues/3548, | |
| 436 https://github.com/fmtlib/fmt/pull/3549, | |
| 437 https://github.com/fmtlib/fmt/pull/3550, | |
| 438 https://github.com/fmtlib/fmt/pull/3552). | |
| 439 Thanks @adesitter, @hmbj, @Minty-Meeo, @phprus, @TobiSchluter, | |
| 440 @kieranclancy, @alexeedm, @jurihock, @Ozomahtli and @razaqq. | |
| 441 | |
| 442 # 10.0.0 - 2023-05-09 | |
| 443 | |
| 444 - Replaced Grisu with a new floating-point formatting algorithm for | |
| 445 given precision (https://github.com/fmtlib/fmt/issues/3262, | |
| 446 https://github.com/fmtlib/fmt/issues/2750, | |
| 447 https://github.com/fmtlib/fmt/pull/3269, | |
| 448 https://github.com/fmtlib/fmt/pull/3276). The new algorithm | |
| 449 is based on Dragonbox already used for the shortest representation | |
| 450 and gives substantial performance improvement: | |
| 451 | |
| 452  | |
| 453 | |
| 454 - Red: new algorithm | |
| 455 - Green: new algorithm with `FMT_USE_FULL_CACHE_DRAGONBOX` defined | |
| 456 to 1 | |
| 457 - Blue: old algorithm | |
| 458 | |
| 459 Thanks @jk-jeon. | |
| 460 | |
| 461 - Replaced `snprintf`-based hex float formatter with an internal | |
| 462 implementation (https://github.com/fmtlib/fmt/pull/3179, | |
| 463 https://github.com/fmtlib/fmt/pull/3203). This removes the | |
| 464 last usage of `s(n)printf` in {fmt}. Thanks @phprus. | |
| 465 | |
| 466 - Fixed alignment of floating-point numbers with localization | |
| 467 (https://github.com/fmtlib/fmt/issues/3263, | |
| 468 https://github.com/fmtlib/fmt/pull/3272). Thanks @ShawnZhong. | |
| 469 | |
| 470 - Made handling of `#` consistent with `std::format`. | |
| 471 | |
| 472 - Improved C++20 module support | |
| 473 (https://github.com/fmtlib/fmt/pull/3134, | |
| 474 https://github.com/fmtlib/fmt/pull/3254, | |
| 475 https://github.com/fmtlib/fmt/pull/3386, | |
| 476 https://github.com/fmtlib/fmt/pull/3387, | |
| 477 https://github.com/fmtlib/fmt/pull/3388, | |
| 478 https://github.com/fmtlib/fmt/pull/3392, | |
| 479 https://github.com/fmtlib/fmt/pull/3397, | |
| 480 https://github.com/fmtlib/fmt/pull/3399, | |
| 481 https://github.com/fmtlib/fmt/pull/3400). | |
| 482 Thanks @laitingsheng, @Orvid and @DanielaE. | |
| 483 | |
| 484 - Switched to the [modules CMake library](https://github.com/vitaut/modules) | |
| 485 which allows building {fmt} as a C++20 module with clang: | |
| 486 | |
| 487 CXX=clang++ cmake -DFMT_MODULE=ON . | |
| 488 make | |
| 489 | |
| 490 - Made `format_as` work with any user-defined type and not just enums. | |
| 491 For example ([godbolt](https://godbolt.org/z/b7rqhq5Kh)): | |
| 492 | |
| 493 ```c++ | |
| 494 #include <fmt/format.h> | |
| 495 | |
| 496 struct floaty_mc_floatface { | |
| 497 double value; | |
| 498 }; | |
| 499 | |
| 500 auto format_as(floaty_mc_floatface f) { return f.value; } | |
| 501 | |
| 502 int main() { | |
| 503 fmt::print("{:8}\n", floaty_mc_floatface{0.42}); // prints " 0.42" | |
| 504 } | |
| 505 ``` | |
| 506 | |
| 507 - Removed deprecated implicit conversions for enums and conversions to | |
| 508 primitive types for compatibility with `std::format` and to prevent | |
| 509 potential ODR violations. Use `format_as` instead. | |
| 510 | |
| 511 - Added support for fill, align and width to the time point formatter | |
| 512 (https://github.com/fmtlib/fmt/issues/3237, | |
| 513 https://github.com/fmtlib/fmt/pull/3260, | |
| 514 https://github.com/fmtlib/fmt/pull/3275). For example | |
| 515 ([godbolt](https://godbolt.org/z/rKP6MGz6c)): | |
| 516 | |
| 517 ```c++ | |
| 518 #include <fmt/chrono.h> | |
| 519 | |
| 520 int main() { | |
| 521 // prints " 2023" | |
| 522 fmt::print("{:>8%Y}\n", std::chrono::system_clock::now()); | |
| 523 } | |
| 524 ``` | |
| 525 | |
| 526 Thanks @ShawnZhong. | |
| 527 | |
| 528 - Implemented formatting of subseconds | |
| 529 (https://github.com/fmtlib/fmt/issues/2207, | |
| 530 https://github.com/fmtlib/fmt/issues/3117, | |
| 531 https://github.com/fmtlib/fmt/pull/3115, | |
| 532 https://github.com/fmtlib/fmt/pull/3143, | |
| 533 https://github.com/fmtlib/fmt/pull/3144, | |
| 534 https://github.com/fmtlib/fmt/pull/3349). For example | |
| 535 ([godbolt](https://godbolt.org/z/45738oGEo)): | |
| 536 | |
| 537 ```c++ | |
| 538 #include <fmt/chrono.h> | |
| 539 | |
| 540 int main() { | |
| 541 // prints 01.234567 | |
| 542 fmt::print("{:%S}\n", std::chrono::microseconds(1234567)); | |
| 543 } | |
| 544 ``` | |
| 545 | |
| 546 Thanks @patrickroocks @phprus and @BRevzin. | |
| 547 | |
| 548 - Added precision support to `%S` | |
| 549 (https://github.com/fmtlib/fmt/pull/3148). Thanks @SappyJoy | |
| 550 | |
| 551 - Added support for `std::utc_time` | |
| 552 (https://github.com/fmtlib/fmt/issues/3098, | |
| 553 https://github.com/fmtlib/fmt/pull/3110). Thanks @patrickroocks. | |
| 554 | |
| 555 - Switched formatting of `std::chrono::system_clock` from local time | |
| 556 to UTC for compatibility with the standard | |
| 557 (https://github.com/fmtlib/fmt/issues/3199, | |
| 558 https://github.com/fmtlib/fmt/pull/3230). Thanks @ned14. | |
| 559 | |
| 560 - Added support for `%Ez` and `%Oz` to chrono formatters. | |
| 561 (https://github.com/fmtlib/fmt/issues/3220, | |
| 562 https://github.com/fmtlib/fmt/pull/3222). Thanks @phprus. | |
| 563 | |
| 564 - Improved validation of format specifiers for `std::chrono::duration` | |
| 565 (https://github.com/fmtlib/fmt/issues/3219, | |
| 566 https://github.com/fmtlib/fmt/pull/3232). Thanks @ShawnZhong. | |
| 567 | |
| 568 - Fixed formatting of time points before the epoch | |
| 569 (https://github.com/fmtlib/fmt/issues/3117, | |
| 570 https://github.com/fmtlib/fmt/pull/3261). For example | |
| 571 ([godbolt](https://godbolt.org/z/f7bcznb3W)): | |
| 572 | |
| 573 ```c++ | |
| 574 #include <fmt/chrono.h> | |
| 575 | |
| 576 int main() { | |
| 577 auto t = std::chrono::system_clock::from_time_t(0) - | |
| 578 std::chrono::milliseconds(250); | |
| 579 fmt::print("{:%S}\n", t); // prints 59.750000000 | |
| 580 } | |
| 581 ``` | |
| 582 | |
| 583 Thanks @ShawnZhong. | |
| 584 | |
| 585 - Experimental: implemented glibc extension for padding seconds, | |
| 586 minutes and hours | |
| 587 (https://github.com/fmtlib/fmt/issues/2959, | |
| 588 https://github.com/fmtlib/fmt/pull/3271). Thanks @ShawnZhong. | |
| 589 | |
| 590 - Added a formatter for `std::exception` | |
| 591 (https://github.com/fmtlib/fmt/issues/2977, | |
| 592 https://github.com/fmtlib/fmt/issues/3012, | |
| 593 https://github.com/fmtlib/fmt/pull/3062, | |
| 594 https://github.com/fmtlib/fmt/pull/3076, | |
| 595 https://github.com/fmtlib/fmt/pull/3119). For example | |
| 596 ([godbolt](https://godbolt.org/z/8xoWGs9e4)): | |
| 597 | |
| 598 ```c++ | |
| 599 #include <fmt/std.h> | |
| 600 #include <vector> | |
| 601 | |
| 602 int main() { | |
| 603 try { | |
| 604 std::vector<bool>().at(0); | |
| 605 } catch(const std::exception& e) { | |
| 606 fmt::print("{}", e); | |
| 607 } | |
| 608 } | |
| 609 ``` | |
| 610 | |
| 611 prints: | |
| 612 | |
| 613 vector<bool>::_M_range_check: __n (which is 0) >= this->size() (which is 0) | |
| 614 | |
| 615 on libstdc++. Thanks @zach2good and @phprus. | |
| 616 | |
| 617 - Moved `std::error_code` formatter from `fmt/os.h` to `fmt/std.h`. | |
| 618 (https://github.com/fmtlib/fmt/pull/3125). Thanks @phprus. | |
| 619 | |
| 620 - Added formatters for standard container adapters: | |
| 621 `std::priority_queue`, `std::queue` and `std::stack` | |
| 622 (https://github.com/fmtlib/fmt/issues/3215, | |
| 623 https://github.com/fmtlib/fmt/pull/3279). For example | |
| 624 ([godbolt](https://godbolt.org/z/74h1xY9qK)): | |
| 625 | |
| 626 ```c++ | |
| 627 #include <fmt/ranges.h> | |
| 628 #include <stack> | |
| 629 #include <vector> | |
| 630 | |
| 631 int main() { | |
| 632 auto s = std::stack<bool, std::vector<bool>>(); | |
| 633 for (auto b: {true, false, true}) s.push(b); | |
| 634 fmt::print("{}\n", s); // prints [true, false, true] | |
| 635 } | |
| 636 ``` | |
| 637 | |
| 638 Thanks @ShawnZhong. | |
| 639 | |
| 640 - Added a formatter for `std::optional` to `fmt/std.h` | |
| 641 (https://github.com/fmtlib/fmt/issues/1367, | |
| 642 https://github.com/fmtlib/fmt/pull/3303). | |
| 643 Thanks @tom-huntington. | |
| 644 | |
| 645 - Fixed formatting of valueless by exception variants | |
| 646 (https://github.com/fmtlib/fmt/pull/3347). Thanks @TheOmegaCarrot. | |
| 647 | |
| 648 - Made `fmt::ptr` accept `unique_ptr` with a custom deleter | |
| 649 (https://github.com/fmtlib/fmt/pull/3177). Thanks @hmbj. | |
| 650 | |
| 651 - Fixed formatting of noncopyable ranges and nested ranges of chars | |
| 652 (https://github.com/fmtlib/fmt/pull/3158 | |
| 653 https://github.com/fmtlib/fmt/issues/3286, | |
| 654 https://github.com/fmtlib/fmt/pull/3290). Thanks @BRevzin. | |
| 655 | |
| 656 - Fixed issues with formatting of paths and ranges of paths | |
| 657 (https://github.com/fmtlib/fmt/issues/3319, | |
| 658 https://github.com/fmtlib/fmt/pull/3321 | |
| 659 https://github.com/fmtlib/fmt/issues/3322). Thanks @phprus. | |
| 660 | |
| 661 - Improved handling of invalid Unicode in paths. | |
| 662 | |
| 663 - Enabled compile-time checks on Apple clang 14 and later | |
| 664 (https://github.com/fmtlib/fmt/pull/3331). Thanks @cloyce. | |
| 665 | |
| 666 - Improved compile-time checks of named arguments | |
| 667 (https://github.com/fmtlib/fmt/issues/3105, | |
| 668 https://github.com/fmtlib/fmt/pull/3214). Thanks @rbrich. | |
| 669 | |
| 670 - Fixed formatting when both alignment and `0` are given | |
| 671 (https://github.com/fmtlib/fmt/issues/3236, | |
| 672 https://github.com/fmtlib/fmt/pull/3248). Thanks @ShawnZhong. | |
| 673 | |
| 674 - Improved Unicode support in the experimental file API on Windows | |
| 675 (https://github.com/fmtlib/fmt/issues/3234, | |
| 676 https://github.com/fmtlib/fmt/pull/3293). Thanks @Fros1er. | |
| 677 | |
| 678 - Unified UTF transcoding | |
| 679 (https://github.com/fmtlib/fmt/pull/3416). Thanks @phprus. | |
| 680 | |
| 681 - Added support for UTF-8 digit separators via an experimental locale | |
| 682 facet (https://github.com/fmtlib/fmt/issues/1861). For | |
| 683 example ([godbolt](https://godbolt.org/z/f7bcznb3W)): | |
| 684 | |
| 685 ```c++ | |
| 686 auto loc = std::locale( | |
| 687 std::locale(), new fmt::format_facet<std::locale>("’")); | |
| 688 auto s = fmt::format(loc, "{:L}", 1000); | |
| 689 ``` | |
| 690 | |
| 691 where `’` is U+2019 used as a digit separator in the de_CH locale. | |
| 692 | |
| 693 - Added an overload of `formatted_size` that takes a locale | |
| 694 (https://github.com/fmtlib/fmt/issues/3084, | |
| 695 https://github.com/fmtlib/fmt/pull/3087). Thanks @gerboengels. | |
| 696 | |
| 697 - Removed the deprecated `FMT_DEPRECATED_OSTREAM`. | |
| 698 | |
| 699 - Fixed a UB when using a null `std::string_view` with | |
| 700 `fmt::to_string` or format string compilation | |
| 701 (https://github.com/fmtlib/fmt/issues/3241, | |
| 702 https://github.com/fmtlib/fmt/pull/3244). Thanks @phprus. | |
| 703 | |
| 704 - Added `starts_with` to the fallback `string_view` implementation | |
| 705 (https://github.com/fmtlib/fmt/pull/3080). Thanks @phprus. | |
| 706 | |
| 707 - Added `fmt::basic_format_string::get()` for compatibility with | |
| 708 `basic_format_string` | |
| 709 (https://github.com/fmtlib/fmt/pull/3111). Thanks @huangqinjin. | |
| 710 | |
| 711 - Added `println` for compatibility with C++23 | |
| 712 (https://github.com/fmtlib/fmt/pull/3267). Thanks @ShawnZhong. | |
| 713 | |
| 714 - Renamed the `FMT_EXPORT` macro for shared library usage to | |
| 715 `FMT_LIB_EXPORT`. | |
| 716 | |
| 717 - Improved documentation | |
| 718 (https://github.com/fmtlib/fmt/issues/3108, | |
| 719 https://github.com/fmtlib/fmt/issues/3169, | |
| 720 https://github.com/fmtlib/fmt/pull/3243). | |
| 721 https://github.com/fmtlib/fmt/pull/3404). | |
| 722 Thanks @Cleroth and @Vertexwahn. | |
| 723 | |
| 724 - Improved build configuration and tests | |
| 725 (https://github.com/fmtlib/fmt/pull/3118, | |
| 726 https://github.com/fmtlib/fmt/pull/3120, | |
| 727 https://github.com/fmtlib/fmt/pull/3188, | |
| 728 https://github.com/fmtlib/fmt/issues/3189, | |
| 729 https://github.com/fmtlib/fmt/pull/3198, | |
| 730 https://github.com/fmtlib/fmt/pull/3205, | |
| 731 https://github.com/fmtlib/fmt/pull/3207, | |
| 732 https://github.com/fmtlib/fmt/pull/3210, | |
| 733 https://github.com/fmtlib/fmt/pull/3240, | |
| 734 https://github.com/fmtlib/fmt/pull/3256, | |
| 735 https://github.com/fmtlib/fmt/pull/3264, | |
| 736 https://github.com/fmtlib/fmt/issues/3299, | |
| 737 https://github.com/fmtlib/fmt/pull/3302, | |
| 738 https://github.com/fmtlib/fmt/pull/3312, | |
| 739 https://github.com/fmtlib/fmt/issues/3317, | |
| 740 https://github.com/fmtlib/fmt/pull/3328, | |
| 741 https://github.com/fmtlib/fmt/pull/3333, | |
| 742 https://github.com/fmtlib/fmt/pull/3369, | |
| 743 https://github.com/fmtlib/fmt/issues/3373, | |
| 744 https://github.com/fmtlib/fmt/pull/3395, | |
| 745 https://github.com/fmtlib/fmt/pull/3406, | |
| 746 https://github.com/fmtlib/fmt/pull/3411). | |
| 747 Thanks @dimztimz, @phprus, @DavidKorczynski, @ChrisThrasher, | |
| 748 @FrancoisCarouge, @kennyweiss, @luzpaz, @codeinred, @Mixaill, @joycebrum, | |
| 749 @kevinhwang and @Vertexwahn. | |
| 750 | |
| 751 - Fixed a regression in handling empty format specifiers after a colon | |
| 752 (`{:}`) (https://github.com/fmtlib/fmt/pull/3086). Thanks @oxidase. | |
| 753 | |
| 754 - Worked around a broken implementation of | |
| 755 `std::is_constant_evaluated` in some versions of libstdc++ on clang | |
| 756 (https://github.com/fmtlib/fmt/issues/3247, | |
| 757 https://github.com/fmtlib/fmt/pull/3281). Thanks @phprus. | |
| 758 | |
| 759 - Fixed formatting of volatile variables | |
| 760 (https://github.com/fmtlib/fmt/pull/3068). | |
| 761 | |
| 762 - Fixed various warnings and compilation issues | |
| 763 (https://github.com/fmtlib/fmt/pull/3057, | |
| 764 https://github.com/fmtlib/fmt/pull/3066, | |
| 765 https://github.com/fmtlib/fmt/pull/3072, | |
| 766 https://github.com/fmtlib/fmt/pull/3082, | |
| 767 https://github.com/fmtlib/fmt/pull/3091, | |
| 768 https://github.com/fmtlib/fmt/issues/3092, | |
| 769 https://github.com/fmtlib/fmt/pull/3093, | |
| 770 https://github.com/fmtlib/fmt/pull/3095, | |
| 771 https://github.com/fmtlib/fmt/issues/3096, | |
| 772 https://github.com/fmtlib/fmt/pull/3097, | |
| 773 https://github.com/fmtlib/fmt/issues/3128, | |
| 774 https://github.com/fmtlib/fmt/pull/3129, | |
| 775 https://github.com/fmtlib/fmt/pull/3137, | |
| 776 https://github.com/fmtlib/fmt/pull/3139, | |
| 777 https://github.com/fmtlib/fmt/issues/3140, | |
| 778 https://github.com/fmtlib/fmt/pull/3142, | |
| 779 https://github.com/fmtlib/fmt/issues/3149, | |
| 780 https://github.com/fmtlib/fmt/pull/3150, | |
| 781 https://github.com/fmtlib/fmt/issues/3154, | |
| 782 https://github.com/fmtlib/fmt/issues/3163, | |
| 783 https://github.com/fmtlib/fmt/issues/3178, | |
| 784 https://github.com/fmtlib/fmt/pull/3184, | |
| 785 https://github.com/fmtlib/fmt/pull/3196, | |
| 786 https://github.com/fmtlib/fmt/issues/3204, | |
| 787 https://github.com/fmtlib/fmt/pull/3206, | |
| 788 https://github.com/fmtlib/fmt/pull/3208, | |
| 789 https://github.com/fmtlib/fmt/issues/3213, | |
| 790 https://github.com/fmtlib/fmt/pull/3216, | |
| 791 https://github.com/fmtlib/fmt/issues/3224, | |
| 792 https://github.com/fmtlib/fmt/issues/3226, | |
| 793 https://github.com/fmtlib/fmt/issues/3228, | |
| 794 https://github.com/fmtlib/fmt/pull/3229, | |
| 795 https://github.com/fmtlib/fmt/pull/3259, | |
| 796 https://github.com/fmtlib/fmt/issues/3274, | |
| 797 https://github.com/fmtlib/fmt/issues/3287, | |
| 798 https://github.com/fmtlib/fmt/pull/3288, | |
| 799 https://github.com/fmtlib/fmt/issues/3292, | |
| 800 https://github.com/fmtlib/fmt/pull/3295, | |
| 801 https://github.com/fmtlib/fmt/pull/3296, | |
| 802 https://github.com/fmtlib/fmt/issues/3298, | |
| 803 https://github.com/fmtlib/fmt/issues/3325, | |
| 804 https://github.com/fmtlib/fmt/pull/3326, | |
| 805 https://github.com/fmtlib/fmt/issues/3334, | |
| 806 https://github.com/fmtlib/fmt/issues/3342, | |
| 807 https://github.com/fmtlib/fmt/pull/3343, | |
| 808 https://github.com/fmtlib/fmt/issues/3351, | |
| 809 https://github.com/fmtlib/fmt/pull/3352, | |
| 810 https://github.com/fmtlib/fmt/pull/3362, | |
| 811 https://github.com/fmtlib/fmt/issues/3365, | |
| 812 https://github.com/fmtlib/fmt/pull/3366, | |
| 813 https://github.com/fmtlib/fmt/pull/3374, | |
| 814 https://github.com/fmtlib/fmt/issues/3377, | |
| 815 https://github.com/fmtlib/fmt/pull/3378, | |
| 816 https://github.com/fmtlib/fmt/issues/3381, | |
| 817 https://github.com/fmtlib/fmt/pull/3398, | |
| 818 https://github.com/fmtlib/fmt/pull/3413, | |
| 819 https://github.com/fmtlib/fmt/issues/3415). | |
| 820 Thanks @phprus, @gsjaardema, @NewbieOrange, @EngineLessCC, @asmaloney, | |
| 821 @HazardyKnusperkeks, @sergiud, @Youw, @thesmurph, @czudziakm, | |
| 822 @Roman-Koshelev, @chronoxor, @ShawnZhong, @russelltg, @glebm, @tmartin-gh, | |
| 823 @Zhaojun-Liu, @louiswins and @mogemimi. | |
| 824 | |
| 825 # 9.1.0 - 2022-08-27 | |
| 826 | |
| 827 - `fmt::formatted_size` now works at compile time | |
| 828 (https://github.com/fmtlib/fmt/pull/3026). For example | |
| 829 ([godbolt](https://godbolt.org/z/1MW5rMdf8)): | |
| 830 | |
| 831 ```c++ | |
| 832 #include <fmt/compile.h> | |
| 833 | |
| 834 int main() { | |
| 835 using namespace fmt::literals; | |
| 836 constexpr size_t n = fmt::formatted_size("{}"_cf, 42); | |
| 837 fmt::print("{}\n", n); // prints 2 | |
| 838 } | |
| 839 ``` | |
| 840 | |
| 841 Thanks @marksantaniello. | |
| 842 | |
| 843 - Fixed handling of invalid UTF-8 | |
| 844 (https://github.com/fmtlib/fmt/pull/3038, | |
| 845 https://github.com/fmtlib/fmt/pull/3044, | |
| 846 https://github.com/fmtlib/fmt/pull/3056). | |
| 847 Thanks @phprus and @skeeto. | |
| 848 | |
| 849 - Improved Unicode support in `ostream` overloads of `print` | |
| 850 (https://github.com/fmtlib/fmt/pull/2994, | |
| 851 https://github.com/fmtlib/fmt/pull/3001, | |
| 852 https://github.com/fmtlib/fmt/pull/3025). Thanks @dimztimz. | |
| 853 | |
| 854 - Fixed handling of the sign specifier in localized formatting on | |
| 855 systems with 32-bit `wchar_t` | |
| 856 (https://github.com/fmtlib/fmt/issues/3041). | |
| 857 | |
| 858 - Added support for wide streams to `fmt::streamed` | |
| 859 (https://github.com/fmtlib/fmt/pull/2994). Thanks @phprus. | |
| 860 | |
| 861 - Added the `n` specifier that disables the output of delimiters when | |
| 862 formatting ranges (https://github.com/fmtlib/fmt/pull/2981, | |
| 863 https://github.com/fmtlib/fmt/pull/2983). For example | |
| 864 ([godbolt](https://godbolt.org/z/roKqGdj8c)): | |
| 865 | |
| 866 ```c++ | |
| 867 #include <fmt/ranges.h> | |
| 868 #include <vector> | |
| 869 | |
| 870 int main() { | |
| 871 auto v = std::vector{1, 2, 3}; | |
| 872 fmt::print("{:n}\n", v); // prints 1, 2, 3 | |
| 873 } | |
| 874 ``` | |
| 875 | |
| 876 Thanks @BRevzin. | |
| 877 | |
| 878 - Worked around problematic `std::string_view` constructors introduced | |
| 879 in C++23 (https://github.com/fmtlib/fmt/issues/3030, | |
| 880 https://github.com/fmtlib/fmt/issues/3050). Thanks @strega-nil-ms. | |
| 881 | |
| 882 - Improve handling (exclusion) of recursive ranges | |
| 883 (https://github.com/fmtlib/fmt/issues/2968, | |
| 884 https://github.com/fmtlib/fmt/pull/2974). Thanks @Dani-Hub. | |
| 885 | |
| 886 - Improved error reporting in format string compilation | |
| 887 (https://github.com/fmtlib/fmt/issues/3055). | |
| 888 | |
| 889 - Improved the implementation of | |
| 890 [Dragonbox](https://github.com/jk-jeon/dragonbox), the algorithm | |
| 891 used for the default floating-point formatting | |
| 892 (https://github.com/fmtlib/fmt/pull/2984). Thanks @jk-jeon. | |
| 893 | |
| 894 - Fixed issues with floating-point formatting on exotic platforms. | |
| 895 | |
| 896 - Improved the implementation of chrono formatting | |
| 897 (https://github.com/fmtlib/fmt/pull/3010). Thanks @phprus. | |
| 898 | |
| 899 - Improved documentation | |
| 900 (https://github.com/fmtlib/fmt/pull/2966, | |
| 901 https://github.com/fmtlib/fmt/pull/3009, | |
| 902 https://github.com/fmtlib/fmt/issues/3020, | |
| 903 https://github.com/fmtlib/fmt/pull/3037). | |
| 904 Thanks @mwinterb, @jcelerier and @remiburtin. | |
| 905 | |
| 906 - Improved build configuration | |
| 907 (https://github.com/fmtlib/fmt/pull/2991, | |
| 908 https://github.com/fmtlib/fmt/pull/2995, | |
| 909 https://github.com/fmtlib/fmt/issues/3004, | |
| 910 https://github.com/fmtlib/fmt/pull/3007, | |
| 911 https://github.com/fmtlib/fmt/pull/3040). | |
| 912 Thanks @dimztimz and @hwhsu1231. | |
| 913 | |
| 914 - Fixed various warnings and compilation issues | |
| 915 (https://github.com/fmtlib/fmt/issues/2969, | |
| 916 https://github.com/fmtlib/fmt/pull/2971, | |
| 917 https://github.com/fmtlib/fmt/issues/2975, | |
| 918 https://github.com/fmtlib/fmt/pull/2982, | |
| 919 https://github.com/fmtlib/fmt/pull/2985, | |
| 920 https://github.com/fmtlib/fmt/issues/2988, | |
| 921 https://github.com/fmtlib/fmt/issues/2989, | |
| 922 https://github.com/fmtlib/fmt/issues/3000, | |
| 923 https://github.com/fmtlib/fmt/issues/3006, | |
| 924 https://github.com/fmtlib/fmt/issues/3014, | |
| 925 https://github.com/fmtlib/fmt/issues/3015, | |
| 926 https://github.com/fmtlib/fmt/pull/3021, | |
| 927 https://github.com/fmtlib/fmt/issues/3023, | |
| 928 https://github.com/fmtlib/fmt/pull/3024, | |
| 929 https://github.com/fmtlib/fmt/pull/3029, | |
| 930 https://github.com/fmtlib/fmt/pull/3043, | |
| 931 https://github.com/fmtlib/fmt/issues/3052, | |
| 932 https://github.com/fmtlib/fmt/pull/3053, | |
| 933 https://github.com/fmtlib/fmt/pull/3054). | |
| 934 Thanks @h-friederich, @dimztimz, @olupton, @bernhardmgruber and @phprus. | |
| 935 | |
| 936 # 9.0.0 - 2022-07-04 | |
| 937 | |
| 938 - Switched to the internal floating point formatter for all decimal | |
| 939 presentation formats. In particular this results in consistent | |
| 940 rounding on all platforms and removing the `s[n]printf` fallback for | |
| 941 decimal FP formatting. | |
| 942 | |
| 943 - Compile-time floating point formatting no longer requires the | |
| 944 header-only mode. For example | |
| 945 ([godbolt](https://godbolt.org/z/G37PTeG3b)): | |
| 946 | |
| 947 ```c++ | |
| 948 #include <array> | |
| 949 #include <fmt/compile.h> | |
| 950 | |
| 951 consteval auto compile_time_dtoa(double value) -> std::array<char, 10> { | |
| 952 auto result = std::array<char, 10>(); | |
| 953 fmt::format_to(result.data(), FMT_COMPILE("{}"), value); | |
| 954 return result; | |
| 955 } | |
| 956 | |
| 957 constexpr auto answer = compile_time_dtoa(0.42); | |
| 958 ``` | |
| 959 | |
| 960 works with the default settings. | |
| 961 | |
| 962 - Improved the implementation of | |
| 963 [Dragonbox](https://github.com/jk-jeon/dragonbox), the algorithm | |
| 964 used for the default floating-point formatting | |
| 965 (https://github.com/fmtlib/fmt/pull/2713, | |
| 966 https://github.com/fmtlib/fmt/pull/2750). Thanks @jk-jeon. | |
| 967 | |
| 968 - Made `fmt::to_string` work with `__float128`. This uses the internal | |
| 969 FP formatter and works even on system without `__float128` support | |
| 970 in `[s]printf`. | |
| 971 | |
| 972 - Disabled automatic `std::ostream` insertion operator (`operator<<`) | |
| 973 discovery when `fmt/ostream.h` is included to prevent ODR | |
| 974 violations. You can get the old behavior by defining | |
| 975 `FMT_DEPRECATED_OSTREAM` but this will be removed in the next major | |
| 976 release. Use `fmt::streamed` or `fmt::ostream_formatter` to enable | |
| 977 formatting via `std::ostream` instead. | |
| 978 | |
| 979 - Added `fmt::ostream_formatter` that can be used to write `formatter` | |
| 980 specializations that perform formatting via `std::ostream`. For | |
| 981 example ([godbolt](https://godbolt.org/z/5sEc5qMsf)): | |
| 982 | |
| 983 ```c++ | |
| 984 #include <fmt/ostream.h> | |
| 985 | |
| 986 struct date { | |
| 987 int year, month, day; | |
| 988 | |
| 989 friend std::ostream& operator<<(std::ostream& os, const date& d) { | |
| 990 return os << d.year << '-' << d.month << '-' << d.day; | |
| 991 } | |
| 992 }; | |
| 993 | |
| 994 template <> struct fmt::formatter<date> : ostream_formatter {}; | |
| 995 | |
| 996 std::string s = fmt::format("The date is {}", date{2012, 12, 9}); | |
| 997 // s == "The date is 2012-12-9" | |
| 998 ``` | |
| 999 | |
| 1000 - Added the `fmt::streamed` function that takes an object and formats | |
| 1001 it via `std::ostream`. For example | |
| 1002 ([godbolt](https://godbolt.org/z/5G3346G1f)): | |
| 1003 | |
| 1004 ```c++ | |
| 1005 #include <thread> | |
| 1006 #include <fmt/ostream.h> | |
| 1007 | |
| 1008 int main() { | |
| 1009 fmt::print("Current thread id: {}\n", | |
| 1010 fmt::streamed(std::this_thread::get_id())); | |
| 1011 } | |
| 1012 ``` | |
| 1013 | |
| 1014 Note that `fmt/std.h` provides a `formatter` specialization for | |
| 1015 `std::thread::id` so you don\'t need to format it via | |
| 1016 `std::ostream`. | |
| 1017 | |
| 1018 - Deprecated implicit conversions of unscoped enums to integers for | |
| 1019 consistency with scoped enums. | |
| 1020 | |
| 1021 - Added an argument-dependent lookup based `format_as` extension API | |
| 1022 to simplify formatting of enums. | |
| 1023 | |
| 1024 - Added experimental `std::variant` formatting support | |
| 1025 (https://github.com/fmtlib/fmt/pull/2941). For example | |
| 1026 ([godbolt](https://godbolt.org/z/KG9z6cq68)): | |
| 1027 | |
| 1028 ```c++ | |
| 1029 #include <variant> | |
| 1030 #include <fmt/std.h> | |
| 1031 | |
| 1032 int main() { | |
| 1033 auto v = std::variant<int, std::string>(42); | |
| 1034 fmt::print("{}\n", v); | |
| 1035 } | |
| 1036 ``` | |
| 1037 | |
| 1038 prints: | |
| 1039 | |
| 1040 variant(42) | |
| 1041 | |
| 1042 Thanks @jehelset. | |
| 1043 | |
| 1044 - Added experimental `std::filesystem::path` formatting support | |
| 1045 (https://github.com/fmtlib/fmt/issues/2865, | |
| 1046 https://github.com/fmtlib/fmt/pull/2902, | |
| 1047 https://github.com/fmtlib/fmt/issues/2917, | |
| 1048 https://github.com/fmtlib/fmt/pull/2918). For example | |
| 1049 ([godbolt](https://godbolt.org/z/o44dMexEb)): | |
| 1050 | |
| 1051 ```c++ | |
| 1052 #include <filesystem> | |
| 1053 #include <fmt/std.h> | |
| 1054 | |
| 1055 int main() { | |
| 1056 fmt::print("There is no place like {}.", std::filesystem::path("/home")); | |
| 1057 } | |
| 1058 ``` | |
| 1059 | |
| 1060 prints: | |
| 1061 | |
| 1062 There is no place like "/home". | |
| 1063 | |
| 1064 Thanks @phprus. | |
| 1065 | |
| 1066 - Added a `std::thread::id` formatter to `fmt/std.h`. For example | |
| 1067 ([godbolt](https://godbolt.org/z/j1azbYf3E)): | |
| 1068 | |
| 1069 ```c++ | |
| 1070 #include <thread> | |
| 1071 #include <fmt/std.h> | |
| 1072 | |
| 1073 int main() { | |
| 1074 fmt::print("Current thread id: {}\n", std::this_thread::get_id()); | |
| 1075 } | |
| 1076 ``` | |
| 1077 | |
| 1078 - Added `fmt::styled` that applies a text style to an individual | |
| 1079 argument (https://github.com/fmtlib/fmt/pull/2793). For | |
| 1080 example ([godbolt](https://godbolt.org/z/vWGW7v5M6)): | |
| 1081 | |
| 1082 ```c++ | |
| 1083 #include <fmt/chrono.h> | |
| 1084 #include <fmt/color.h> | |
| 1085 | |
| 1086 int main() { | |
| 1087 auto now = std::chrono::system_clock::now(); | |
| 1088 fmt::print( | |
| 1089 "[{}] {}: {}\n", | |
| 1090 fmt::styled(now, fmt::emphasis::bold), | |
| 1091 fmt::styled("error", fg(fmt::color::red)), | |
| 1092 "something went wrong"); | |
| 1093 } | |
| 1094 ``` | |
| 1095 | |
| 1096 prints | |
| 1097 | |
| 1098  | |
| 1099 | |
| 1100 Thanks @rbrugo. | |
| 1101 | |
| 1102 - Made `fmt::print` overload for text styles correctly handle UTF-8 | |
| 1103 (https://github.com/fmtlib/fmt/issues/2681, | |
| 1104 https://github.com/fmtlib/fmt/pull/2701). Thanks @AlexGuteniev. | |
| 1105 | |
| 1106 - Fixed Unicode handling when writing to an ostream. | |
| 1107 | |
| 1108 - Added support for nested specifiers to range formatting | |
| 1109 (https://github.com/fmtlib/fmt/pull/2673). For example | |
| 1110 ([godbolt](https://godbolt.org/z/xd3Gj38cf)): | |
| 1111 | |
| 1112 ```c++ | |
| 1113 #include <vector> | |
| 1114 #include <fmt/ranges.h> | |
| 1115 | |
| 1116 int main() { | |
| 1117 fmt::print("{::#x}\n", std::vector{10, 20, 30}); | |
| 1118 } | |
| 1119 ``` | |
| 1120 | |
| 1121 prints `[0xa, 0x14, 0x1e]`. | |
| 1122 | |
| 1123 Thanks @BRevzin. | |
| 1124 | |
| 1125 - Implemented escaping of wide strings in ranges | |
| 1126 (https://github.com/fmtlib/fmt/pull/2904). Thanks @phprus. | |
| 1127 | |
| 1128 - Added support for ranges with `begin` / `end` found via the | |
| 1129 argument-dependent lookup | |
| 1130 (https://github.com/fmtlib/fmt/pull/2807). Thanks @rbrugo. | |
| 1131 | |
| 1132 - Fixed formatting of certain kinds of ranges of ranges | |
| 1133 (https://github.com/fmtlib/fmt/pull/2787). Thanks @BRevzin. | |
| 1134 | |
| 1135 - Fixed handling of maps with element types other than `std::pair` | |
| 1136 (https://github.com/fmtlib/fmt/pull/2944). Thanks @BrukerJWD. | |
| 1137 | |
| 1138 - Made tuple formatter enabled only if elements are formattable | |
| 1139 (https://github.com/fmtlib/fmt/issues/2939, | |
| 1140 https://github.com/fmtlib/fmt/pull/2940). Thanks @jehelset. | |
| 1141 | |
| 1142 - Made `fmt::join` compatible with format string compilation | |
| 1143 (https://github.com/fmtlib/fmt/issues/2719, | |
| 1144 https://github.com/fmtlib/fmt/pull/2720). Thanks @phprus. | |
| 1145 | |
| 1146 - Made compile-time checks work with named arguments of custom types | |
| 1147 and `std::ostream` `print` overloads | |
| 1148 (https://github.com/fmtlib/fmt/issues/2816, | |
| 1149 https://github.com/fmtlib/fmt/issues/2817, | |
| 1150 https://github.com/fmtlib/fmt/pull/2819). Thanks @timsong-cpp. | |
| 1151 | |
| 1152 - Removed `make_args_checked` because it is no longer needed for | |
| 1153 compile-time checks | |
| 1154 (https://github.com/fmtlib/fmt/pull/2760). Thanks @phprus. | |
| 1155 | |
| 1156 - Removed the following deprecated APIs: `_format`, `arg_join`, the | |
| 1157 `format_to` overload that takes a memory buffer, `[v]fprintf` that | |
| 1158 takes an `ostream`. | |
| 1159 | |
| 1160 - Removed the deprecated implicit conversion of `[const] signed char*` | |
| 1161 and `[const] unsigned char*` to C strings. | |
| 1162 | |
| 1163 - Removed the deprecated `fmt/locale.h`. | |
| 1164 | |
| 1165 - Replaced the deprecated `fileno()` with `descriptor()` in | |
| 1166 `buffered_file`. | |
| 1167 | |
| 1168 - Moved `to_string_view` to the `detail` namespace since it\'s an | |
| 1169 implementation detail. | |
| 1170 | |
| 1171 - Made access mode of a created file consistent with `fopen` by | |
| 1172 setting `S_IWGRP` and `S_IWOTH` | |
| 1173 (https://github.com/fmtlib/fmt/pull/2733). Thanks @arogge. | |
| 1174 | |
| 1175 - Removed a redundant buffer resize when formatting to `std::ostream` | |
| 1176 (https://github.com/fmtlib/fmt/issues/2842, | |
| 1177 https://github.com/fmtlib/fmt/pull/2843). Thanks @jcelerier. | |
| 1178 | |
| 1179 - Made precision computation for strings consistent with width | |
| 1180 (https://github.com/fmtlib/fmt/issues/2888). | |
| 1181 | |
| 1182 - Fixed handling of locale separators in floating point formatting | |
| 1183 (https://github.com/fmtlib/fmt/issues/2830). | |
| 1184 | |
| 1185 - Made sign specifiers work with `__int128_t` | |
| 1186 (https://github.com/fmtlib/fmt/issues/2773). | |
| 1187 | |
| 1188 - Improved support for systems such as CHERI with extra data stored in | |
| 1189 pointers (https://github.com/fmtlib/fmt/pull/2932). | |
| 1190 Thanks @davidchisnall. | |
| 1191 | |
| 1192 - Improved documentation | |
| 1193 (https://github.com/fmtlib/fmt/pull/2706, | |
| 1194 https://github.com/fmtlib/fmt/pull/2712, | |
| 1195 https://github.com/fmtlib/fmt/pull/2789, | |
| 1196 https://github.com/fmtlib/fmt/pull/2803, | |
| 1197 https://github.com/fmtlib/fmt/pull/2805, | |
| 1198 https://github.com/fmtlib/fmt/pull/2815, | |
| 1199 https://github.com/fmtlib/fmt/pull/2924). | |
| 1200 Thanks @BRevzin, @Pokechu22, @setoye, @rtobar, @rbrugo, @anoonD and | |
| 1201 @leha-bot. | |
| 1202 | |
| 1203 - Improved build configuration | |
| 1204 (https://github.com/fmtlib/fmt/pull/2766, | |
| 1205 https://github.com/fmtlib/fmt/pull/2772, | |
| 1206 https://github.com/fmtlib/fmt/pull/2836, | |
| 1207 https://github.com/fmtlib/fmt/pull/2852, | |
| 1208 https://github.com/fmtlib/fmt/pull/2907, | |
| 1209 https://github.com/fmtlib/fmt/pull/2913, | |
| 1210 https://github.com/fmtlib/fmt/pull/2914). | |
| 1211 Thanks @kambala-decapitator, @mattiasljungstrom, @kieselnb, @nathannaveen | |
| 1212 and @Vertexwahn. | |
| 1213 | |
| 1214 - Fixed various warnings and compilation issues | |
| 1215 (https://github.com/fmtlib/fmt/issues/2408, | |
| 1216 https://github.com/fmtlib/fmt/issues/2507, | |
| 1217 https://github.com/fmtlib/fmt/issues/2697, | |
| 1218 https://github.com/fmtlib/fmt/issues/2715, | |
| 1219 https://github.com/fmtlib/fmt/issues/2717, | |
| 1220 https://github.com/fmtlib/fmt/pull/2722, | |
| 1221 https://github.com/fmtlib/fmt/pull/2724, | |
| 1222 https://github.com/fmtlib/fmt/pull/2725, | |
| 1223 https://github.com/fmtlib/fmt/issues/2726, | |
| 1224 https://github.com/fmtlib/fmt/pull/2728, | |
| 1225 https://github.com/fmtlib/fmt/pull/2732, | |
| 1226 https://github.com/fmtlib/fmt/issues/2738, | |
| 1227 https://github.com/fmtlib/fmt/pull/2742, | |
| 1228 https://github.com/fmtlib/fmt/issues/2744, | |
| 1229 https://github.com/fmtlib/fmt/issues/2745, | |
| 1230 https://github.com/fmtlib/fmt/issues/2746, | |
| 1231 https://github.com/fmtlib/fmt/issues/2754, | |
| 1232 https://github.com/fmtlib/fmt/pull/2755, | |
| 1233 https://github.com/fmtlib/fmt/issues/2757, | |
| 1234 https://github.com/fmtlib/fmt/pull/2758, | |
| 1235 https://github.com/fmtlib/fmt/issues/2761, | |
| 1236 https://github.com/fmtlib/fmt/pull/2762, | |
| 1237 https://github.com/fmtlib/fmt/issues/2763, | |
| 1238 https://github.com/fmtlib/fmt/pull/2765, | |
| 1239 https://github.com/fmtlib/fmt/issues/2769, | |
| 1240 https://github.com/fmtlib/fmt/pull/2770, | |
| 1241 https://github.com/fmtlib/fmt/issues/2771, | |
| 1242 https://github.com/fmtlib/fmt/issues/2777, | |
| 1243 https://github.com/fmtlib/fmt/pull/2779, | |
| 1244 https://github.com/fmtlib/fmt/pull/2782, | |
| 1245 https://github.com/fmtlib/fmt/pull/2783, | |
| 1246 https://github.com/fmtlib/fmt/issues/2794, | |
| 1247 https://github.com/fmtlib/fmt/issues/2796, | |
| 1248 https://github.com/fmtlib/fmt/pull/2797, | |
| 1249 https://github.com/fmtlib/fmt/pull/2801, | |
| 1250 https://github.com/fmtlib/fmt/pull/2802, | |
| 1251 https://github.com/fmtlib/fmt/issues/2808, | |
| 1252 https://github.com/fmtlib/fmt/issues/2818, | |
| 1253 https://github.com/fmtlib/fmt/pull/2819, | |
| 1254 https://github.com/fmtlib/fmt/issues/2829, | |
| 1255 https://github.com/fmtlib/fmt/issues/2835, | |
| 1256 https://github.com/fmtlib/fmt/issues/2848, | |
| 1257 https://github.com/fmtlib/fmt/issues/2860, | |
| 1258 https://github.com/fmtlib/fmt/pull/2861, | |
| 1259 https://github.com/fmtlib/fmt/pull/2882, | |
| 1260 https://github.com/fmtlib/fmt/issues/2886, | |
| 1261 https://github.com/fmtlib/fmt/issues/2891, | |
| 1262 https://github.com/fmtlib/fmt/pull/2892, | |
| 1263 https://github.com/fmtlib/fmt/issues/2895, | |
| 1264 https://github.com/fmtlib/fmt/issues/2896, | |
| 1265 https://github.com/fmtlib/fmt/pull/2903, | |
| 1266 https://github.com/fmtlib/fmt/issues/2906, | |
| 1267 https://github.com/fmtlib/fmt/issues/2908, | |
| 1268 https://github.com/fmtlib/fmt/pull/2909, | |
| 1269 https://github.com/fmtlib/fmt/issues/2920, | |
| 1270 https://github.com/fmtlib/fmt/pull/2922, | |
| 1271 https://github.com/fmtlib/fmt/pull/2927, | |
| 1272 https://github.com/fmtlib/fmt/pull/2929, | |
| 1273 https://github.com/fmtlib/fmt/issues/2936, | |
| 1274 https://github.com/fmtlib/fmt/pull/2937, | |
| 1275 https://github.com/fmtlib/fmt/pull/2938, | |
| 1276 https://github.com/fmtlib/fmt/pull/2951, | |
| 1277 https://github.com/fmtlib/fmt/issues/2954, | |
| 1278 https://github.com/fmtlib/fmt/pull/2957, | |
| 1279 https://github.com/fmtlib/fmt/issues/2958, | |
| 1280 https://github.com/fmtlib/fmt/pull/2960). | |
| 1281 Thanks @matrackif @Tobi823, @ivan-volnov, @VasiliPupkin256, | |
| 1282 @federico-busato, @barcharcraz, @jk-jeon, @HazardyKnusperkeks, @dalboris, | |
| 1283 @seanm, @gsjaardema, @timsong-cpp, @seanm, @frithrah, @chronoxor, @Agga, | |
| 1284 @madmaxoft, @JurajX, @phprus and @Dani-Hub. | |
| 1285 | |
| 1286 # 8.1.1 - 2022-01-06 | |
| 1287 | |
| 1288 - Restored ABI compatibility with version 8.0.x | |
| 1289 (https://github.com/fmtlib/fmt/issues/2695, | |
| 1290 https://github.com/fmtlib/fmt/pull/2696). Thanks @saraedum. | |
| 1291 - Fixed chrono formatting on big endian systems | |
| 1292 (https://github.com/fmtlib/fmt/issues/2698, | |
| 1293 https://github.com/fmtlib/fmt/pull/2699). | |
| 1294 Thanks @phprus and @xvitaly. | |
| 1295 - Fixed a linkage error with mingw | |
| 1296 (https://github.com/fmtlib/fmt/issues/2691, | |
| 1297 https://github.com/fmtlib/fmt/pull/2692). Thanks @rbberger. | |
| 1298 | |
| 1299 # 8.1.0 - 2022-01-02 | |
| 1300 | |
| 1301 - Optimized chrono formatting | |
| 1302 (https://github.com/fmtlib/fmt/pull/2500, | |
| 1303 https://github.com/fmtlib/fmt/pull/2537, | |
| 1304 https://github.com/fmtlib/fmt/issues/2541, | |
| 1305 https://github.com/fmtlib/fmt/pull/2544, | |
| 1306 https://github.com/fmtlib/fmt/pull/2550, | |
| 1307 https://github.com/fmtlib/fmt/pull/2551, | |
| 1308 https://github.com/fmtlib/fmt/pull/2576, | |
| 1309 https://github.com/fmtlib/fmt/issues/2577, | |
| 1310 https://github.com/fmtlib/fmt/pull/2586, | |
| 1311 https://github.com/fmtlib/fmt/pull/2591, | |
| 1312 https://github.com/fmtlib/fmt/pull/2594, | |
| 1313 https://github.com/fmtlib/fmt/pull/2602, | |
| 1314 https://github.com/fmtlib/fmt/pull/2617, | |
| 1315 https://github.com/fmtlib/fmt/issues/2628, | |
| 1316 https://github.com/fmtlib/fmt/pull/2633, | |
| 1317 https://github.com/fmtlib/fmt/issues/2670, | |
| 1318 https://github.com/fmtlib/fmt/pull/2671). | |
| 1319 | |
| 1320 Processing of some specifiers such as `%z` and `%Y` is now up to | |
| 1321 10-20 times faster, for example on GCC 11 with libstdc++: | |
| 1322 | |
| 1323 ---------------------------------------------------------------------------- | |
| 1324 Benchmark Before After | |
| 1325 ---------------------------------------------------------------------------- | |
| 1326 FMTFormatter_z 261 ns 26.3 ns | |
| 1327 FMTFormatterCompile_z 246 ns 11.6 ns | |
| 1328 FMTFormatter_Y 263 ns 26.1 ns | |
| 1329 FMTFormatterCompile_Y 244 ns 10.5 ns | |
| 1330 ---------------------------------------------------------------------------- | |
| 1331 | |
| 1332 Thanks @phprus and @toughengineer. | |
| 1333 | |
| 1334 - Implemented subsecond formatting for chrono durations | |
| 1335 (https://github.com/fmtlib/fmt/pull/2623). For example | |
| 1336 ([godbolt](https://godbolt.org/z/es7vWTETe)): | |
| 1337 | |
| 1338 ```c++ | |
| 1339 #include <fmt/chrono.h> | |
| 1340 | |
| 1341 int main() { | |
| 1342 fmt::print("{:%S}", std::chrono::milliseconds(1234)); | |
| 1343 } | |
| 1344 ``` | |
| 1345 | |
| 1346 prints \"01.234\". | |
| 1347 | |
| 1348 Thanks @matrackif. | |
| 1349 | |
| 1350 - Fixed handling of precision 0 when formatting chrono durations | |
| 1351 (https://github.com/fmtlib/fmt/issues/2587, | |
| 1352 https://github.com/fmtlib/fmt/pull/2588). Thanks @lukester1975. | |
| 1353 | |
| 1354 - Fixed an overflow on invalid inputs in the `tm` formatter | |
| 1355 (https://github.com/fmtlib/fmt/pull/2564). Thanks @phprus. | |
| 1356 | |
| 1357 - Added `fmt::group_digits` that formats integers with a non-localized | |
| 1358 digit separator (comma) for groups of three digits. For example | |
| 1359 ([godbolt](https://godbolt.org/z/TxGxG9Poq)): | |
| 1360 | |
| 1361 ```c++ | |
| 1362 #include <fmt/format.h> | |
| 1363 | |
| 1364 int main() { | |
| 1365 fmt::print("{} dollars", fmt::group_digits(1000000)); | |
| 1366 } | |
| 1367 ``` | |
| 1368 | |
| 1369 prints \"1,000,000 dollars\". | |
| 1370 | |
| 1371 - Added support for faint, conceal, reverse and blink text styles | |
| 1372 (https://github.com/fmtlib/fmt/pull/2394): | |
| 1373 | |
| 1374 <https://user-images.githubusercontent.com/576385/147710227-c68f5317-f8fa-42c3-9123-7c4ba3c398cb.mp4> | |
| 1375 | |
| 1376 Thanks @benit8 and @data-man. | |
| 1377 | |
| 1378 - Added experimental support for compile-time floating point | |
| 1379 formatting (https://github.com/fmtlib/fmt/pull/2426, | |
| 1380 https://github.com/fmtlib/fmt/pull/2470). It is currently | |
| 1381 limited to the header-only mode. Thanks @alexezeder. | |
| 1382 | |
| 1383 - Added UDL-based named argument support to compile-time format string | |
| 1384 checks (https://github.com/fmtlib/fmt/issues/2640, | |
| 1385 https://github.com/fmtlib/fmt/pull/2649). For example | |
| 1386 ([godbolt](https://godbolt.org/z/ohGbbvonv)): | |
| 1387 | |
| 1388 ```c++ | |
| 1389 #include <fmt/format.h> | |
| 1390 | |
| 1391 int main() { | |
| 1392 using namespace fmt::literals; | |
| 1393 fmt::print("{answer:s}", "answer"_a=42); | |
| 1394 } | |
| 1395 ``` | |
| 1396 | |
| 1397 gives a compile-time error on compilers with C++20 `consteval` and | |
| 1398 non-type template parameter support (gcc 10+) because `s` is not a | |
| 1399 valid format specifier for an integer. | |
| 1400 | |
| 1401 Thanks @alexezeder. | |
| 1402 | |
| 1403 - Implemented escaping of string range elements. For example | |
| 1404 ([godbolt](https://godbolt.org/z/rKvM1vKf3)): | |
| 1405 | |
| 1406 ```c++ | |
| 1407 #include <fmt/ranges.h> | |
| 1408 #include <vector> | |
| 1409 | |
| 1410 int main() { | |
| 1411 fmt::print("{}", std::vector<std::string>{"\naan"}); | |
| 1412 } | |
| 1413 ``` | |
| 1414 | |
| 1415 is now printed as: | |
| 1416 | |
| 1417 ["\naan"] | |
| 1418 | |
| 1419 instead of: | |
| 1420 | |
| 1421 [" | |
| 1422 aan"] | |
| 1423 | |
| 1424 - Added an experimental `?` specifier for escaping strings. | |
| 1425 (https://github.com/fmtlib/fmt/pull/2674). Thanks @BRevzin. | |
| 1426 | |
| 1427 - Switched to JSON-like representation of maps and sets for | |
| 1428 consistency with Python\'s `str.format`. For example | |
| 1429 ([godbolt](https://godbolt.org/z/seKjoY9W5)): | |
| 1430 | |
| 1431 ```c++ | |
| 1432 #include <fmt/ranges.h> | |
| 1433 #include <map> | |
| 1434 | |
| 1435 int main() { | |
| 1436 fmt::print("{}", std::map<std::string, int>{{"answer", 42}}); | |
| 1437 } | |
| 1438 ``` | |
| 1439 | |
| 1440 is now printed as: | |
| 1441 | |
| 1442 {"answer": 42} | |
| 1443 | |
| 1444 - Extended `fmt::join` to support C++20-only ranges | |
| 1445 (https://github.com/fmtlib/fmt/pull/2549). Thanks @BRevzin. | |
| 1446 | |
| 1447 - Optimized handling of non-const-iterable ranges and implemented | |
| 1448 initial support for non-const-formattable types. | |
| 1449 | |
| 1450 - Disabled implicit conversions of scoped enums to integers that was | |
| 1451 accidentally introduced in earlier versions | |
| 1452 (https://github.com/fmtlib/fmt/pull/1841). | |
| 1453 | |
| 1454 - Deprecated implicit conversion of `[const] signed char*` and | |
| 1455 `[const] unsigned char*` to C strings. | |
| 1456 | |
| 1457 - Deprecated `_format`, a legacy UDL-based format API | |
| 1458 (https://github.com/fmtlib/fmt/pull/2646). Thanks @alexezeder. | |
| 1459 | |
| 1460 - Marked `format`, `formatted_size` and `to_string` as `[[nodiscard]]` | |
| 1461 (https://github.com/fmtlib/fmt/pull/2612). @0x8000-0000. | |
| 1462 | |
| 1463 - Added missing diagnostic when trying to format function and member | |
| 1464 pointers as well as objects convertible to pointers which is | |
| 1465 explicitly disallowed | |
| 1466 (https://github.com/fmtlib/fmt/issues/2598, | |
| 1467 https://github.com/fmtlib/fmt/pull/2609, | |
| 1468 https://github.com/fmtlib/fmt/pull/2610). Thanks @AlexGuteniev. | |
| 1469 | |
| 1470 - Optimized writing to a contiguous buffer with `format_to_n` | |
| 1471 (https://github.com/fmtlib/fmt/pull/2489). Thanks @Roman-Koshelev. | |
| 1472 | |
| 1473 - Optimized writing to non-`char` buffers | |
| 1474 (https://github.com/fmtlib/fmt/pull/2477). Thanks @Roman-Koshelev. | |
| 1475 | |
| 1476 - Decimal point is now localized when using the `L` specifier. | |
| 1477 | |
| 1478 - Improved floating point formatter implementation | |
| 1479 (https://github.com/fmtlib/fmt/pull/2498, | |
| 1480 https://github.com/fmtlib/fmt/pull/2499). Thanks @Roman-Koshelev. | |
| 1481 | |
| 1482 - Fixed handling of very large precision in fixed format | |
| 1483 (https://github.com/fmtlib/fmt/pull/2616). | |
| 1484 | |
| 1485 - Made a table of cached powers used in FP formatting static | |
| 1486 (https://github.com/fmtlib/fmt/pull/2509). Thanks @jk-jeon. | |
| 1487 | |
| 1488 - Resolved a lookup ambiguity with C++20 format-related functions due | |
| 1489 to ADL (https://github.com/fmtlib/fmt/issues/2639, | |
| 1490 https://github.com/fmtlib/fmt/pull/2641). Thanks @mkurdej. | |
| 1491 | |
| 1492 - Removed unnecessary inline namespace qualification | |
| 1493 (https://github.com/fmtlib/fmt/issues/2642, | |
| 1494 https://github.com/fmtlib/fmt/pull/2643). Thanks @mkurdej. | |
| 1495 | |
| 1496 - Implemented argument forwarding in `format_to_n` | |
| 1497 (https://github.com/fmtlib/fmt/issues/2462, | |
| 1498 https://github.com/fmtlib/fmt/pull/2463). Thanks @owent. | |
| 1499 | |
| 1500 - Fixed handling of implicit conversions in `fmt::to_string` and | |
| 1501 format string compilation | |
| 1502 (https://github.com/fmtlib/fmt/issues/2565). | |
| 1503 | |
| 1504 - Changed the default access mode of files created by | |
| 1505 `fmt::output_file` to `-rw-r--r--` for consistency with `fopen` | |
| 1506 (https://github.com/fmtlib/fmt/issues/2530). | |
| 1507 | |
| 1508 - Make `fmt::ostream::flush` public | |
| 1509 (https://github.com/fmtlib/fmt/issues/2435). | |
| 1510 | |
| 1511 - Improved C++14/17 attribute detection | |
| 1512 (https://github.com/fmtlib/fmt/pull/2615). Thanks @AlexGuteniev. | |
| 1513 | |
| 1514 - Improved `consteval` detection for MSVC | |
| 1515 (https://github.com/fmtlib/fmt/pull/2559). Thanks @DanielaE. | |
| 1516 | |
| 1517 - Improved documentation | |
| 1518 (https://github.com/fmtlib/fmt/issues/2406, | |
| 1519 https://github.com/fmtlib/fmt/pull/2446, | |
| 1520 https://github.com/fmtlib/fmt/issues/2493, | |
| 1521 https://github.com/fmtlib/fmt/issues/2513, | |
| 1522 https://github.com/fmtlib/fmt/pull/2515, | |
| 1523 https://github.com/fmtlib/fmt/issues/2522, | |
| 1524 https://github.com/fmtlib/fmt/pull/2562, | |
| 1525 https://github.com/fmtlib/fmt/pull/2575, | |
| 1526 https://github.com/fmtlib/fmt/pull/2606, | |
| 1527 https://github.com/fmtlib/fmt/pull/2620, | |
| 1528 https://github.com/fmtlib/fmt/issues/2676). | |
| 1529 Thanks @sobolevn, @UnePierre, @zhsj, @phprus, @ericcurtin and @Lounarok. | |
| 1530 | |
| 1531 - Improved fuzzers and added a fuzzer for chrono timepoint formatting | |
| 1532 (https://github.com/fmtlib/fmt/pull/2461, | |
| 1533 https://github.com/fmtlib/fmt/pull/2469). @pauldreik, | |
| 1534 | |
| 1535 - Added the `FMT_SYSTEM_HEADERS` CMake option setting which marks | |
| 1536 {fmt}\'s headers as system. It can be used to suppress warnings | |
| 1537 (https://github.com/fmtlib/fmt/issues/2644, | |
| 1538 https://github.com/fmtlib/fmt/pull/2651). Thanks @alexezeder. | |
| 1539 | |
| 1540 - Added the Bazel build system support | |
| 1541 (https://github.com/fmtlib/fmt/pull/2505, | |
| 1542 https://github.com/fmtlib/fmt/pull/2516). Thanks @Vertexwahn. | |
| 1543 | |
| 1544 - Improved build configuration and tests | |
| 1545 (https://github.com/fmtlib/fmt/issues/2437, | |
| 1546 https://github.com/fmtlib/fmt/pull/2558, | |
| 1547 https://github.com/fmtlib/fmt/pull/2648, | |
| 1548 https://github.com/fmtlib/fmt/pull/2650, | |
| 1549 https://github.com/fmtlib/fmt/pull/2663, | |
| 1550 https://github.com/fmtlib/fmt/pull/2677). | |
| 1551 Thanks @DanielaE, @alexezeder and @phprus. | |
| 1552 | |
| 1553 - Fixed various warnings and compilation issues | |
| 1554 (https://github.com/fmtlib/fmt/pull/2353, | |
| 1555 https://github.com/fmtlib/fmt/pull/2356, | |
| 1556 https://github.com/fmtlib/fmt/pull/2399, | |
| 1557 https://github.com/fmtlib/fmt/issues/2408, | |
| 1558 https://github.com/fmtlib/fmt/pull/2414, | |
| 1559 https://github.com/fmtlib/fmt/pull/2427, | |
| 1560 https://github.com/fmtlib/fmt/pull/2432, | |
| 1561 https://github.com/fmtlib/fmt/pull/2442, | |
| 1562 https://github.com/fmtlib/fmt/pull/2434, | |
| 1563 https://github.com/fmtlib/fmt/issues/2439, | |
| 1564 https://github.com/fmtlib/fmt/pull/2447, | |
| 1565 https://github.com/fmtlib/fmt/pull/2450, | |
| 1566 https://github.com/fmtlib/fmt/issues/2455, | |
| 1567 https://github.com/fmtlib/fmt/issues/2465, | |
| 1568 https://github.com/fmtlib/fmt/issues/2472, | |
| 1569 https://github.com/fmtlib/fmt/issues/2474, | |
| 1570 https://github.com/fmtlib/fmt/pull/2476, | |
| 1571 https://github.com/fmtlib/fmt/issues/2478, | |
| 1572 https://github.com/fmtlib/fmt/issues/2479, | |
| 1573 https://github.com/fmtlib/fmt/issues/2481, | |
| 1574 https://github.com/fmtlib/fmt/pull/2482, | |
| 1575 https://github.com/fmtlib/fmt/pull/2483, | |
| 1576 https://github.com/fmtlib/fmt/issues/2490, | |
| 1577 https://github.com/fmtlib/fmt/pull/2491, | |
| 1578 https://github.com/fmtlib/fmt/pull/2510, | |
| 1579 https://github.com/fmtlib/fmt/pull/2518, | |
| 1580 https://github.com/fmtlib/fmt/issues/2528, | |
| 1581 https://github.com/fmtlib/fmt/pull/2529, | |
| 1582 https://github.com/fmtlib/fmt/pull/2539, | |
| 1583 https://github.com/fmtlib/fmt/issues/2540, | |
| 1584 https://github.com/fmtlib/fmt/pull/2545, | |
| 1585 https://github.com/fmtlib/fmt/pull/2555, | |
| 1586 https://github.com/fmtlib/fmt/issues/2557, | |
| 1587 https://github.com/fmtlib/fmt/issues/2570, | |
| 1588 https://github.com/fmtlib/fmt/pull/2573, | |
| 1589 https://github.com/fmtlib/fmt/pull/2582, | |
| 1590 https://github.com/fmtlib/fmt/issues/2605, | |
| 1591 https://github.com/fmtlib/fmt/pull/2611, | |
| 1592 https://github.com/fmtlib/fmt/pull/2647, | |
| 1593 https://github.com/fmtlib/fmt/issues/2627, | |
| 1594 https://github.com/fmtlib/fmt/pull/2630, | |
| 1595 https://github.com/fmtlib/fmt/issues/2635, | |
| 1596 https://github.com/fmtlib/fmt/issues/2638, | |
| 1597 https://github.com/fmtlib/fmt/issues/2653, | |
| 1598 https://github.com/fmtlib/fmt/issues/2654, | |
| 1599 https://github.com/fmtlib/fmt/issues/2661, | |
| 1600 https://github.com/fmtlib/fmt/pull/2664, | |
| 1601 https://github.com/fmtlib/fmt/pull/2684). | |
| 1602 Thanks @DanielaE, @mwinterb, @cdacamar, @TrebledJ, @bodomartin, @cquammen, | |
| 1603 @white238, @mmarkeloff, @palacaze, @jcelerier, @mborn-adi, @BrukerJWD, | |
| 1604 @spyridon97, @phprus, @oliverlee, @joshessman-llnl, @akohlmey, @timkalu, | |
| 1605 @olupton, @Acretock, @alexezeder, @andrewcorrigan, @lucpelletier and | |
| 1606 @HazardyKnusperkeks. | |
| 1607 | |
| 1608 # 8.0.1 - 2021-07-02 | |
| 1609 | |
| 1610 - Fixed the version number in the inline namespace | |
| 1611 (https://github.com/fmtlib/fmt/issues/2374). | |
| 1612 - Added a missing presentation type check for `std::string` | |
| 1613 (https://github.com/fmtlib/fmt/issues/2402). | |
| 1614 - Fixed a linkage error when mixing code built with clang and gcc | |
| 1615 (https://github.com/fmtlib/fmt/issues/2377). | |
| 1616 - Fixed documentation issues | |
| 1617 (https://github.com/fmtlib/fmt/pull/2396, | |
| 1618 https://github.com/fmtlib/fmt/issues/2403, | |
| 1619 https://github.com/fmtlib/fmt/issues/2406). Thanks @mkurdej. | |
| 1620 - Removed dead code in FP formatter ( | |
| 1621 https://github.com/fmtlib/fmt/pull/2398). Thanks @javierhonduco. | |
| 1622 - Fixed various warnings and compilation issues | |
| 1623 (https://github.com/fmtlib/fmt/issues/2351, | |
| 1624 https://github.com/fmtlib/fmt/issues/2359, | |
| 1625 https://github.com/fmtlib/fmt/pull/2365, | |
| 1626 https://github.com/fmtlib/fmt/issues/2368, | |
| 1627 https://github.com/fmtlib/fmt/pull/2370, | |
| 1628 https://github.com/fmtlib/fmt/pull/2376, | |
| 1629 https://github.com/fmtlib/fmt/pull/2381, | |
| 1630 https://github.com/fmtlib/fmt/pull/2382, | |
| 1631 https://github.com/fmtlib/fmt/issues/2386, | |
| 1632 https://github.com/fmtlib/fmt/pull/2389, | |
| 1633 https://github.com/fmtlib/fmt/pull/2395, | |
| 1634 https://github.com/fmtlib/fmt/pull/2397, | |
| 1635 https://github.com/fmtlib/fmt/issues/2400, | |
| 1636 https://github.com/fmtlib/fmt/issues/2401, | |
| 1637 https://github.com/fmtlib/fmt/pull/2407). | |
| 1638 Thanks @zx2c4, @AidanSun05, @mattiasljungstrom, @joemmett, @erengy, | |
| 1639 @patlkli, @gsjaardema and @phprus. | |
| 1640 | |
| 1641 # 8.0.0 - 2021-06-21 | |
| 1642 | |
| 1643 - Enabled compile-time format string checks by default. For example | |
| 1644 ([godbolt](https://godbolt.org/z/sMxcohGjz)): | |
| 1645 | |
| 1646 ```c++ | |
| 1647 #include <fmt/core.h> | |
| 1648 | |
| 1649 int main() { | |
| 1650 fmt::print("{:d}", "I am not a number"); | |
| 1651 } | |
| 1652 ``` | |
| 1653 | |
| 1654 gives a compile-time error on compilers with C++20 `consteval` | |
| 1655 support (gcc 10+, clang 11+) because `d` is not a valid format | |
| 1656 specifier for a string. | |
| 1657 | |
| 1658 To pass a runtime string wrap it in `fmt::runtime`: | |
| 1659 | |
| 1660 ```c++ | |
| 1661 fmt::print(fmt::runtime("{:d}"), "I am not a number"); | |
| 1662 ``` | |
| 1663 | |
| 1664 - Added compile-time formatting | |
| 1665 (https://github.com/fmtlib/fmt/pull/2019, | |
| 1666 https://github.com/fmtlib/fmt/pull/2044, | |
| 1667 https://github.com/fmtlib/fmt/pull/2056, | |
| 1668 https://github.com/fmtlib/fmt/pull/2072, | |
| 1669 https://github.com/fmtlib/fmt/pull/2075, | |
| 1670 https://github.com/fmtlib/fmt/issues/2078, | |
| 1671 https://github.com/fmtlib/fmt/pull/2129, | |
| 1672 https://github.com/fmtlib/fmt/pull/2326). For example | |
| 1673 ([godbolt](https://godbolt.org/z/Mxx9d89jM)): | |
| 1674 | |
| 1675 ```c++ | |
| 1676 #include <fmt/compile.h> | |
| 1677 | |
| 1678 consteval auto compile_time_itoa(int value) -> std::array<char, 10> { | |
| 1679 auto result = std::array<char, 10>(); | |
| 1680 fmt::format_to(result.data(), FMT_COMPILE("{}"), value); | |
| 1681 return result; | |
| 1682 } | |
| 1683 | |
| 1684 constexpr auto answer = compile_time_itoa(42); | |
| 1685 ``` | |
| 1686 | |
| 1687 Most of the formatting functionality is available at compile time | |
| 1688 with a notable exception of floating-point numbers and pointers. | |
| 1689 Thanks @alexezeder. | |
| 1690 | |
| 1691 - Optimized handling of format specifiers during format string | |
| 1692 compilation. For example, hexadecimal formatting (`"{:x}"`) is now | |
| 1693 3-7x faster than before when using `format_to` with format string | |
| 1694 compilation and a stack-allocated buffer | |
| 1695 (https://github.com/fmtlib/fmt/issues/1944). | |
| 1696 | |
| 1697 Before (7.1.3): | |
| 1698 | |
| 1699 ---------------------------------------------------------------------------- | |
| 1700 Benchmark Time CPU Iterations | |
| 1701 ---------------------------------------------------------------------------- | |
| 1702 FMTCompileOld/0 15.5 ns 15.5 ns 43302898 | |
| 1703 FMTCompileOld/42 16.6 ns 16.6 ns 43278267 | |
| 1704 FMTCompileOld/273123 18.7 ns 18.6 ns 37035861 | |
| 1705 FMTCompileOld/9223372036854775807 19.4 ns 19.4 ns 35243000 | |
| 1706 ---------------------------------------------------------------------------- | |
| 1707 | |
| 1708 After (8.x): | |
| 1709 | |
| 1710 ---------------------------------------------------------------------------- | |
| 1711 Benchmark Time CPU Iterations | |
| 1712 ---------------------------------------------------------------------------- | |
| 1713 FMTCompileNew/0 1.99 ns 1.99 ns 360523686 | |
| 1714 FMTCompileNew/42 2.33 ns 2.33 ns 279865664 | |
| 1715 FMTCompileNew/273123 3.72 ns 3.71 ns 190230315 | |
| 1716 FMTCompileNew/9223372036854775807 5.28 ns 5.26 ns 130711631 | |
| 1717 ---------------------------------------------------------------------------- | |
| 1718 | |
| 1719 It is even faster than `std::to_chars` from libc++ compiled with | |
| 1720 clang on macOS: | |
| 1721 | |
| 1722 ---------------------------------------------------------------------------- | |
| 1723 Benchmark Time CPU Iterations | |
| 1724 ---------------------------------------------------------------------------- | |
| 1725 ToChars/0 4.42 ns 4.41 ns 160196630 | |
| 1726 ToChars/42 5.00 ns 4.98 ns 140735201 | |
| 1727 ToChars/273123 7.26 ns 7.24 ns 95784130 | |
| 1728 ToChars/9223372036854775807 8.77 ns 8.75 ns 75872534 | |
| 1729 ---------------------------------------------------------------------------- | |
| 1730 | |
| 1731 In other cases, especially involving `std::string` construction, the | |
| 1732 speed up is usually lower because handling format specifiers takes a | |
| 1733 smaller fraction of the total time. | |
| 1734 | |
| 1735 - Added the `_cf` user-defined literal to represent a compiled format | |
| 1736 string. It can be used instead of the `FMT_COMPILE` macro | |
| 1737 (https://github.com/fmtlib/fmt/pull/2043, | |
| 1738 https://github.com/fmtlib/fmt/pull/2242): | |
| 1739 | |
| 1740 ```c++ | |
| 1741 #include <fmt/compile.h> | |
| 1742 | |
| 1743 using namespace fmt::literals; | |
| 1744 auto s = fmt::format(FMT_COMPILE("{}"), 42); // 🙁 not modern | |
| 1745 auto s = fmt::format("{}"_cf, 42); // 🙂 modern as hell | |
| 1746 ``` | |
| 1747 | |
| 1748 It requires compiler support for class types in non-type template | |
| 1749 parameters (a C++20 feature) which is available in GCC 9.3+. | |
| 1750 Thanks @alexezeder. | |
| 1751 | |
| 1752 - Format string compilation now requires `format` functions of | |
| 1753 `formatter` specializations for user-defined types to be `const`: | |
| 1754 | |
| 1755 ```c++ | |
| 1756 template <> struct fmt::formatter<my_type>: formatter<string_view> { | |
| 1757 template <typename FormatContext> | |
| 1758 auto format(my_type obj, FormatContext& ctx) const { // Note const here. | |
| 1759 // ... | |
| 1760 } | |
| 1761 }; | |
| 1762 ``` | |
| 1763 | |
| 1764 - Added UDL-based named argument support to format string compilation | |
| 1765 (https://github.com/fmtlib/fmt/pull/2243, | |
| 1766 https://github.com/fmtlib/fmt/pull/2281). For example: | |
| 1767 | |
| 1768 ```c++ | |
| 1769 #include <fmt/compile.h> | |
| 1770 | |
| 1771 using namespace fmt::literals; | |
| 1772 auto s = fmt::format(FMT_COMPILE("{answer}"), "answer"_a = 42); | |
| 1773 ``` | |
| 1774 | |
| 1775 Here the argument named \"answer\" is resolved at compile time with | |
| 1776 no runtime overhead. Thanks @alexezeder. | |
| 1777 | |
| 1778 - Added format string compilation support to `fmt::print` | |
| 1779 (https://github.com/fmtlib/fmt/issues/2280, | |
| 1780 https://github.com/fmtlib/fmt/pull/2304). Thanks @alexezeder. | |
| 1781 | |
| 1782 - Added initial support for compiling {fmt} as a C++20 module | |
| 1783 (https://github.com/fmtlib/fmt/pull/2235, | |
| 1784 https://github.com/fmtlib/fmt/pull/2240, | |
| 1785 https://github.com/fmtlib/fmt/pull/2260, | |
| 1786 https://github.com/fmtlib/fmt/pull/2282, | |
| 1787 https://github.com/fmtlib/fmt/pull/2283, | |
| 1788 https://github.com/fmtlib/fmt/pull/2288, | |
| 1789 https://github.com/fmtlib/fmt/pull/2298, | |
| 1790 https://github.com/fmtlib/fmt/pull/2306, | |
| 1791 https://github.com/fmtlib/fmt/pull/2307, | |
| 1792 https://github.com/fmtlib/fmt/pull/2309, | |
| 1793 https://github.com/fmtlib/fmt/pull/2318, | |
| 1794 https://github.com/fmtlib/fmt/pull/2324, | |
| 1795 https://github.com/fmtlib/fmt/pull/2332, | |
| 1796 https://github.com/fmtlib/fmt/pull/2340). Thanks @DanielaE. | |
| 1797 | |
| 1798 - Made symbols private by default reducing shared library size | |
| 1799 (https://github.com/fmtlib/fmt/pull/2301). For example | |
| 1800 there was a \~15% reported reduction on one platform. Thanks @sergiud. | |
| 1801 | |
| 1802 - Optimized includes making the result of preprocessing `fmt/format.h` | |
| 1803 \~20% smaller with libstdc++/C++20 and slightly improving build | |
| 1804 times (https://github.com/fmtlib/fmt/issues/1998). | |
| 1805 | |
| 1806 - Added support of ranges with non-const `begin` / `end` | |
| 1807 (https://github.com/fmtlib/fmt/pull/1953). Thanks @kitegi. | |
| 1808 | |
| 1809 - Added support of `std::byte` and other formattable types to | |
| 1810 `fmt::join` (https://github.com/fmtlib/fmt/issues/1981, | |
| 1811 https://github.com/fmtlib/fmt/issues/2040, | |
| 1812 https://github.com/fmtlib/fmt/pull/2050, | |
| 1813 https://github.com/fmtlib/fmt/issues/2262). For example: | |
| 1814 | |
| 1815 ```c++ | |
| 1816 #include <fmt/format.h> | |
| 1817 #include <cstddef> | |
| 1818 #include <vector> | |
| 1819 | |
| 1820 int main() { | |
| 1821 auto bytes = std::vector{std::byte(4), std::byte(2)}; | |
| 1822 fmt::print("{}", fmt::join(bytes, "")); | |
| 1823 } | |
| 1824 ``` | |
| 1825 | |
| 1826 prints \"42\". | |
| 1827 | |
| 1828 Thanks @kamibo. | |
| 1829 | |
| 1830 - Implemented the default format for `std::chrono::system_clock` | |
| 1831 (https://github.com/fmtlib/fmt/issues/2319, | |
| 1832 https://github.com/fmtlib/fmt/pull/2345). For example: | |
| 1833 | |
| 1834 ```c++ | |
| 1835 #include <fmt/chrono.h> | |
| 1836 | |
| 1837 int main() { | |
| 1838 fmt::print("{}", std::chrono::system_clock::now()); | |
| 1839 } | |
| 1840 ``` | |
| 1841 | |
| 1842 prints \"2021-06-18 15:22:00\" (the output depends on the current | |
| 1843 date and time). Thanks @sunmy2019. | |
| 1844 | |
| 1845 - Made more chrono specifiers locale independent by default. Use the | |
| 1846 `'L'` specifier to get localized formatting. For example: | |
| 1847 | |
| 1848 ```c++ | |
| 1849 #include <fmt/chrono.h> | |
| 1850 | |
| 1851 int main() { | |
| 1852 std::locale::global(std::locale("ru_RU.UTF-8")); | |
| 1853 auto monday = std::chrono::weekday(1); | |
| 1854 fmt::print("{}\n", monday); // prints "Mon" | |
| 1855 fmt::print("{:L}\n", monday); // prints "пн" | |
| 1856 } | |
| 1857 ``` | |
| 1858 | |
| 1859 - Improved locale handling in chrono formatting | |
| 1860 (https://github.com/fmtlib/fmt/issues/2337, | |
| 1861 https://github.com/fmtlib/fmt/pull/2349, | |
| 1862 https://github.com/fmtlib/fmt/pull/2350). Thanks @phprus. | |
| 1863 | |
| 1864 - Deprecated `fmt/locale.h` moving the formatting functions that take | |
| 1865 a locale to `fmt/format.h` (`char`) and `fmt/xchar` (other | |
| 1866 overloads). This doesn\'t introduce a dependency on `<locale>` so | |
| 1867 there is virtually no compile time effect. | |
| 1868 | |
| 1869 - Deprecated an undocumented `format_to` overload that takes | |
| 1870 `basic_memory_buffer`. | |
| 1871 | |
| 1872 - Made parameter order in `vformat_to` consistent with `format_to` | |
| 1873 (https://github.com/fmtlib/fmt/issues/2327). | |
| 1874 | |
| 1875 - Added support for time points with arbitrary durations | |
| 1876 (https://github.com/fmtlib/fmt/issues/2208). For example: | |
| 1877 | |
| 1878 ```c++ | |
| 1879 #include <fmt/chrono.h> | |
| 1880 | |
| 1881 int main() { | |
| 1882 using tp = std::chrono::time_point< | |
| 1883 std::chrono::system_clock, std::chrono::seconds>; | |
| 1884 fmt::print("{:%S}", tp(std::chrono::seconds(42))); | |
| 1885 } | |
| 1886 ``` | |
| 1887 | |
| 1888 prints \"42\". | |
| 1889 | |
| 1890 - Formatting floating-point numbers no longer produces trailing zeros | |
| 1891 by default for consistency with `std::format`. For example: | |
| 1892 | |
| 1893 ```c++ | |
| 1894 #include <fmt/core.h> | |
| 1895 | |
| 1896 int main() { | |
| 1897 fmt::print("{0:.3}", 1.1); | |
| 1898 } | |
| 1899 ``` | |
| 1900 | |
| 1901 prints \"1.1\". Use the `'#'` specifier to keep trailing zeros. | |
| 1902 | |
| 1903 - Dropped a limit on the number of elements in a range and replaced | |
| 1904 `{}` with `[]` as range delimiters for consistency with Python\'s | |
| 1905 `str.format`. | |
| 1906 | |
| 1907 - The `'L'` specifier for locale-specific numeric formatting can now | |
| 1908 be combined with presentation specifiers as in `std::format`. For | |
| 1909 example: | |
| 1910 | |
| 1911 ```c++ | |
| 1912 #include <fmt/core.h> | |
| 1913 #include <locale> | |
| 1914 | |
| 1915 int main() { | |
| 1916 std::locale::global(std::locale("fr_FR.UTF-8")); | |
| 1917 fmt::print("{0:.2Lf}", 0.42); | |
| 1918 } | |
| 1919 ``` | |
| 1920 | |
| 1921 prints \"0,42\". The deprecated `'n'` specifier has been removed. | |
| 1922 | |
| 1923 - Made the `0` specifier ignored for infinity and NaN | |
| 1924 (https://github.com/fmtlib/fmt/issues/2305, | |
| 1925 https://github.com/fmtlib/fmt/pull/2310). Thanks @Liedtke. | |
| 1926 | |
| 1927 - Made the hexfloat formatting use the right alignment by default | |
| 1928 (https://github.com/fmtlib/fmt/issues/2308, | |
| 1929 https://github.com/fmtlib/fmt/pull/2317). Thanks @Liedtke. | |
| 1930 | |
| 1931 - Removed the deprecated numeric alignment (`'='`). Use the `'0'` | |
| 1932 specifier instead. | |
| 1933 | |
| 1934 - Removed the deprecated `fmt/posix.h` header that has been replaced | |
| 1935 with `fmt/os.h`. | |
| 1936 | |
| 1937 - Removed the deprecated `format_to_n_context`, `format_to_n_args` and | |
| 1938 `make_format_to_n_args`. They have been replaced with | |
| 1939 `format_context`, `` format_args` and ``make_format_args\`\` | |
| 1940 respectively. | |
| 1941 | |
| 1942 - Moved `wchar_t`-specific functions and types to `fmt/xchar.h`. You | |
| 1943 can define `FMT_DEPRECATED_INCLUDE_XCHAR` to automatically include | |
| 1944 `fmt/xchar.h` from `fmt/format.h` but this will be disabled in the | |
| 1945 next major release. | |
| 1946 | |
| 1947 - Fixed handling of the `'+'` specifier in localized formatting | |
| 1948 (https://github.com/fmtlib/fmt/issues/2133). | |
| 1949 | |
| 1950 - Added support for the `'s'` format specifier that gives textual | |
| 1951 representation of `bool` | |
| 1952 (https://github.com/fmtlib/fmt/issues/2094, | |
| 1953 https://github.com/fmtlib/fmt/pull/2109). For example: | |
| 1954 | |
| 1955 ```c++ | |
| 1956 #include <fmt/core.h> | |
| 1957 | |
| 1958 int main() { | |
| 1959 fmt::print("{:s}", true); | |
| 1960 } | |
| 1961 ``` | |
| 1962 | |
| 1963 prints \"true\". Thanks @powercoderlol. | |
| 1964 | |
| 1965 - Made `fmt::ptr` work with function pointers | |
| 1966 (https://github.com/fmtlib/fmt/pull/2131). For example: | |
| 1967 | |
| 1968 ```c++ | |
| 1969 #include <fmt/format.h> | |
| 1970 | |
| 1971 int main() { | |
| 1972 fmt::print("My main: {}\n", fmt::ptr(main)); | |
| 1973 } | |
| 1974 ``` | |
| 1975 | |
| 1976 Thanks @mikecrowe. | |
| 1977 | |
| 1978 - The undocumented support for specializing `formatter` for pointer | |
| 1979 types has been removed. | |
| 1980 | |
| 1981 - Fixed `fmt::formatted_size` with format string compilation | |
| 1982 (https://github.com/fmtlib/fmt/pull/2141, | |
| 1983 https://github.com/fmtlib/fmt/pull/2161). Thanks @alexezeder. | |
| 1984 | |
| 1985 - Fixed handling of empty format strings during format string | |
| 1986 compilation (https://github.com/fmtlib/fmt/issues/2042): | |
| 1987 | |
| 1988 ```c++ | |
| 1989 auto s = fmt::format(FMT_COMPILE("")); | |
| 1990 ``` | |
| 1991 | |
| 1992 Thanks @alexezeder. | |
| 1993 | |
| 1994 - Fixed handling of enums in `fmt::to_string` | |
| 1995 (https://github.com/fmtlib/fmt/issues/2036). | |
| 1996 | |
| 1997 - Improved width computation | |
| 1998 (https://github.com/fmtlib/fmt/issues/2033, | |
| 1999 https://github.com/fmtlib/fmt/issues/2091). For example: | |
| 2000 | |
| 2001 ```c++ | |
| 2002 #include <fmt/core.h> | |
| 2003 | |
| 2004 int main() { | |
| 2005 fmt::print("{:-<10}{}\n", "你好", "世界"); | |
| 2006 fmt::print("{:-<10}{}\n", "hello", "world"); | |
| 2007 } | |
| 2008 ``` | |
| 2009 | |
| 2010 prints | |
| 2011 | |
| 2012  | |
| 2013 | |
| 2014 on a modern terminal. | |
| 2015 | |
| 2016 - The experimental fast output stream (`fmt::ostream`) is now | |
| 2017 truncated by default for consistency with `fopen` | |
| 2018 (https://github.com/fmtlib/fmt/issues/2018). For example: | |
| 2019 | |
| 2020 ```c++ | |
| 2021 #include <fmt/os.h> | |
| 2022 | |
| 2023 int main() { | |
| 2024 fmt::ostream out1 = fmt::output_file("guide"); | |
| 2025 out1.print("Zaphod"); | |
| 2026 out1.close(); | |
| 2027 fmt::ostream out2 = fmt::output_file("guide"); | |
| 2028 out2.print("Ford"); | |
| 2029 } | |
| 2030 ``` | |
| 2031 | |
| 2032 writes \"Ford\" to the file \"guide\". To preserve the old file | |
| 2033 content if any pass `fmt::file::WRONLY | fmt::file::CREATE` flags to | |
| 2034 `fmt::output_file`. | |
| 2035 | |
| 2036 - Fixed moving of `fmt::ostream` that holds buffered data | |
| 2037 (https://github.com/fmtlib/fmt/issues/2197, | |
| 2038 https://github.com/fmtlib/fmt/pull/2198). Thanks @vtta. | |
| 2039 | |
| 2040 - Replaced the `fmt::system_error` exception with a function of the | |
| 2041 same name that constructs `std::system_error` | |
| 2042 (https://github.com/fmtlib/fmt/issues/2266). | |
| 2043 | |
| 2044 - Replaced the `fmt::windows_error` exception with a function of the | |
| 2045 same name that constructs `std::system_error` with the category | |
| 2046 returned by `fmt::system_category()` | |
| 2047 (https://github.com/fmtlib/fmt/issues/2274, | |
| 2048 https://github.com/fmtlib/fmt/pull/2275). The latter is | |
| 2049 similar to `std::sytem_category` but correctly handles UTF-8. | |
| 2050 Thanks @phprus. | |
| 2051 | |
| 2052 - Replaced `fmt::error_code` with `std::error_code` and made it | |
| 2053 formattable (https://github.com/fmtlib/fmt/issues/2269, | |
| 2054 https://github.com/fmtlib/fmt/pull/2270, | |
| 2055 https://github.com/fmtlib/fmt/pull/2273). Thanks @phprus. | |
| 2056 | |
| 2057 - Added speech synthesis support | |
| 2058 (https://github.com/fmtlib/fmt/pull/2206). | |
| 2059 | |
| 2060 - Made `format_to` work with a memory buffer that has a custom | |
| 2061 allocator (https://github.com/fmtlib/fmt/pull/2300). | |
| 2062 Thanks @voxmea. | |
| 2063 | |
| 2064 - Added `Allocator::max_size` support to `basic_memory_buffer`. | |
| 2065 (https://github.com/fmtlib/fmt/pull/1960). Thanks @phprus. | |
| 2066 | |
| 2067 - Added wide string support to `fmt::join` | |
| 2068 (https://github.com/fmtlib/fmt/pull/2236). Thanks @crbrz. | |
| 2069 | |
| 2070 - Made iterators passed to `formatter` specializations via a format | |
| 2071 context satisfy C++20 `std::output_iterator` requirements | |
| 2072 (https://github.com/fmtlib/fmt/issues/2156, | |
| 2073 https://github.com/fmtlib/fmt/pull/2158, | |
| 2074 https://github.com/fmtlib/fmt/issues/2195, | |
| 2075 https://github.com/fmtlib/fmt/pull/2204). Thanks @randomnetcat. | |
| 2076 | |
| 2077 - Optimized the `printf` implementation | |
| 2078 (https://github.com/fmtlib/fmt/pull/1982, | |
| 2079 https://github.com/fmtlib/fmt/pull/1984, | |
| 2080 https://github.com/fmtlib/fmt/pull/2016, | |
| 2081 https://github.com/fmtlib/fmt/pull/2164). | |
| 2082 Thanks @rimathia and @moiwi. | |
| 2083 | |
| 2084 - Improved detection of `constexpr` `char_traits` | |
| 2085 (https://github.com/fmtlib/fmt/pull/2246, | |
| 2086 https://github.com/fmtlib/fmt/pull/2257). Thanks @phprus. | |
| 2087 | |
| 2088 - Fixed writing to `stdout` when it is redirected to `NUL` on Windows | |
| 2089 (https://github.com/fmtlib/fmt/issues/2080). | |
| 2090 | |
| 2091 - Fixed exception propagation from iterators | |
| 2092 (https://github.com/fmtlib/fmt/issues/2097). | |
| 2093 | |
| 2094 - Improved `strftime` error handling | |
| 2095 (https://github.com/fmtlib/fmt/issues/2238, | |
| 2096 https://github.com/fmtlib/fmt/pull/2244). Thanks @yumeyao. | |
| 2097 | |
| 2098 - Stopped using deprecated GCC UDL template extension. | |
| 2099 | |
| 2100 - Added `fmt/args.h` to the install target | |
| 2101 (https://github.com/fmtlib/fmt/issues/2096). | |
| 2102 | |
| 2103 - Error messages are now passed to assert when exceptions are disabled | |
| 2104 (https://github.com/fmtlib/fmt/pull/2145). Thanks @NobodyXu. | |
| 2105 | |
| 2106 - Added the `FMT_MASTER_PROJECT` CMake option to control build and | |
| 2107 install targets when {fmt} is included via `add_subdirectory` | |
| 2108 (https://github.com/fmtlib/fmt/issues/2098, | |
| 2109 https://github.com/fmtlib/fmt/pull/2100). | |
| 2110 Thanks @randomizedthinking. | |
| 2111 | |
| 2112 - Improved build configuration | |
| 2113 (https://github.com/fmtlib/fmt/pull/2026, | |
| 2114 https://github.com/fmtlib/fmt/pull/2122). | |
| 2115 Thanks @luncliff and @ibaned. | |
| 2116 | |
| 2117 - Fixed various warnings and compilation issues | |
| 2118 (https://github.com/fmtlib/fmt/issues/1947, | |
| 2119 https://github.com/fmtlib/fmt/pull/1959, | |
| 2120 https://github.com/fmtlib/fmt/pull/1963, | |
| 2121 https://github.com/fmtlib/fmt/pull/1965, | |
| 2122 https://github.com/fmtlib/fmt/issues/1966, | |
| 2123 https://github.com/fmtlib/fmt/pull/1974, | |
| 2124 https://github.com/fmtlib/fmt/pull/1975, | |
| 2125 https://github.com/fmtlib/fmt/pull/1990, | |
| 2126 https://github.com/fmtlib/fmt/issues/2000, | |
| 2127 https://github.com/fmtlib/fmt/pull/2001, | |
| 2128 https://github.com/fmtlib/fmt/issues/2002, | |
| 2129 https://github.com/fmtlib/fmt/issues/2004, | |
| 2130 https://github.com/fmtlib/fmt/pull/2006, | |
| 2131 https://github.com/fmtlib/fmt/pull/2009, | |
| 2132 https://github.com/fmtlib/fmt/pull/2010, | |
| 2133 https://github.com/fmtlib/fmt/issues/2038, | |
| 2134 https://github.com/fmtlib/fmt/issues/2039, | |
| 2135 https://github.com/fmtlib/fmt/issues/2047, | |
| 2136 https://github.com/fmtlib/fmt/pull/2053, | |
| 2137 https://github.com/fmtlib/fmt/issues/2059, | |
| 2138 https://github.com/fmtlib/fmt/pull/2065, | |
| 2139 https://github.com/fmtlib/fmt/pull/2067, | |
| 2140 https://github.com/fmtlib/fmt/pull/2068, | |
| 2141 https://github.com/fmtlib/fmt/pull/2073, | |
| 2142 https://github.com/fmtlib/fmt/issues/2103, | |
| 2143 https://github.com/fmtlib/fmt/issues/2105, | |
| 2144 https://github.com/fmtlib/fmt/pull/2106, | |
| 2145 https://github.com/fmtlib/fmt/pull/2107, | |
| 2146 https://github.com/fmtlib/fmt/issues/2116, | |
| 2147 https://github.com/fmtlib/fmt/pull/2117, | |
| 2148 https://github.com/fmtlib/fmt/issues/2118, | |
| 2149 https://github.com/fmtlib/fmt/pull/2119, | |
| 2150 https://github.com/fmtlib/fmt/issues/2127, | |
| 2151 https://github.com/fmtlib/fmt/pull/2128, | |
| 2152 https://github.com/fmtlib/fmt/issues/2140, | |
| 2153 https://github.com/fmtlib/fmt/issues/2142, | |
| 2154 https://github.com/fmtlib/fmt/pull/2143, | |
| 2155 https://github.com/fmtlib/fmt/pull/2144, | |
| 2156 https://github.com/fmtlib/fmt/issues/2147, | |
| 2157 https://github.com/fmtlib/fmt/issues/2148, | |
| 2158 https://github.com/fmtlib/fmt/issues/2149, | |
| 2159 https://github.com/fmtlib/fmt/pull/2152, | |
| 2160 https://github.com/fmtlib/fmt/pull/2160, | |
| 2161 https://github.com/fmtlib/fmt/issues/2170, | |
| 2162 https://github.com/fmtlib/fmt/issues/2175, | |
| 2163 https://github.com/fmtlib/fmt/issues/2176, | |
| 2164 https://github.com/fmtlib/fmt/pull/2177, | |
| 2165 https://github.com/fmtlib/fmt/issues/2178, | |
| 2166 https://github.com/fmtlib/fmt/pull/2179, | |
| 2167 https://github.com/fmtlib/fmt/issues/2180, | |
| 2168 https://github.com/fmtlib/fmt/issues/2181, | |
| 2169 https://github.com/fmtlib/fmt/pull/2183, | |
| 2170 https://github.com/fmtlib/fmt/issues/2184, | |
| 2171 https://github.com/fmtlib/fmt/issues/2185, | |
| 2172 https://github.com/fmtlib/fmt/pull/2186, | |
| 2173 https://github.com/fmtlib/fmt/pull/2187, | |
| 2174 https://github.com/fmtlib/fmt/pull/2190, | |
| 2175 https://github.com/fmtlib/fmt/pull/2192, | |
| 2176 https://github.com/fmtlib/fmt/pull/2194, | |
| 2177 https://github.com/fmtlib/fmt/pull/2205, | |
| 2178 https://github.com/fmtlib/fmt/issues/2210, | |
| 2179 https://github.com/fmtlib/fmt/pull/2211, | |
| 2180 https://github.com/fmtlib/fmt/pull/2215, | |
| 2181 https://github.com/fmtlib/fmt/pull/2216, | |
| 2182 https://github.com/fmtlib/fmt/pull/2218, | |
| 2183 https://github.com/fmtlib/fmt/pull/2220, | |
| 2184 https://github.com/fmtlib/fmt/issues/2228, | |
| 2185 https://github.com/fmtlib/fmt/pull/2229, | |
| 2186 https://github.com/fmtlib/fmt/pull/2230, | |
| 2187 https://github.com/fmtlib/fmt/issues/2233, | |
| 2188 https://github.com/fmtlib/fmt/pull/2239, | |
| 2189 https://github.com/fmtlib/fmt/issues/2248, | |
| 2190 https://github.com/fmtlib/fmt/issues/2252, | |
| 2191 https://github.com/fmtlib/fmt/pull/2253, | |
| 2192 https://github.com/fmtlib/fmt/pull/2255, | |
| 2193 https://github.com/fmtlib/fmt/issues/2261, | |
| 2194 https://github.com/fmtlib/fmt/issues/2278, | |
| 2195 https://github.com/fmtlib/fmt/issues/2284, | |
| 2196 https://github.com/fmtlib/fmt/pull/2287, | |
| 2197 https://github.com/fmtlib/fmt/pull/2289, | |
| 2198 https://github.com/fmtlib/fmt/pull/2290, | |
| 2199 https://github.com/fmtlib/fmt/pull/2293, | |
| 2200 https://github.com/fmtlib/fmt/issues/2295, | |
| 2201 https://github.com/fmtlib/fmt/pull/2296, | |
| 2202 https://github.com/fmtlib/fmt/pull/2297, | |
| 2203 https://github.com/fmtlib/fmt/issues/2311, | |
| 2204 https://github.com/fmtlib/fmt/pull/2313, | |
| 2205 https://github.com/fmtlib/fmt/pull/2315, | |
| 2206 https://github.com/fmtlib/fmt/issues/2320, | |
| 2207 https://github.com/fmtlib/fmt/pull/2321, | |
| 2208 https://github.com/fmtlib/fmt/pull/2323, | |
| 2209 https://github.com/fmtlib/fmt/issues/2328, | |
| 2210 https://github.com/fmtlib/fmt/pull/2329, | |
| 2211 https://github.com/fmtlib/fmt/pull/2333, | |
| 2212 https://github.com/fmtlib/fmt/pull/2338, | |
| 2213 https://github.com/fmtlib/fmt/pull/2341). | |
| 2214 Thanks @darklukee, @fagg, @killerbot242, @jgopel, @yeswalrus, @Finkman, | |
| 2215 @HazardyKnusperkeks, @dkavolis, @concatime, @chronoxor, @summivox, @yNeo, | |
| 2216 @Apache-HB, @alexezeder, @toojays, @Brainy0207, @vadz, @imsherlock, @phprus, | |
| 2217 @white238, @yafshar, @BillyDonahue, @jstaahl, @denchat, @DanielaE, | |
| 2218 @ilyakurdyukov, @ilmai, @JessyDL, @sergiud, @mwinterb, @sven-herrmann, | |
| 2219 @jmelas, @twoixter, @crbrz and @upsj. | |
| 2220 | |
| 2221 - Improved documentation | |
| 2222 (https://github.com/fmtlib/fmt/issues/1986, | |
| 2223 https://github.com/fmtlib/fmt/pull/2051, | |
| 2224 https://github.com/fmtlib/fmt/issues/2057, | |
| 2225 https://github.com/fmtlib/fmt/pull/2081, | |
| 2226 https://github.com/fmtlib/fmt/issues/2084, | |
| 2227 https://github.com/fmtlib/fmt/pull/2312). | |
| 2228 Thanks @imba-tjd, @0x416c69 and @mordante. | |
| 2229 | |
| 2230 - Continuous integration and test improvements | |
| 2231 (https://github.com/fmtlib/fmt/issues/1969, | |
| 2232 https://github.com/fmtlib/fmt/pull/1991, | |
| 2233 https://github.com/fmtlib/fmt/pull/2020, | |
| 2234 https://github.com/fmtlib/fmt/pull/2110, | |
| 2235 https://github.com/fmtlib/fmt/pull/2114, | |
| 2236 https://github.com/fmtlib/fmt/issues/2196, | |
| 2237 https://github.com/fmtlib/fmt/pull/2217, | |
| 2238 https://github.com/fmtlib/fmt/pull/2247, | |
| 2239 https://github.com/fmtlib/fmt/pull/2256, | |
| 2240 https://github.com/fmtlib/fmt/pull/2336, | |
| 2241 https://github.com/fmtlib/fmt/pull/2346). | |
| 2242 Thanks @jgopel, @alexezeder and @DanielaE. | |
| 2243 | |
| 2244 # 7.1.3 - 2020-11-24 | |
| 2245 | |
| 2246 - Fixed handling of buffer boundaries in `format_to_n` | |
| 2247 (https://github.com/fmtlib/fmt/issues/1996, | |
| 2248 https://github.com/fmtlib/fmt/issues/2029). | |
| 2249 - Fixed linkage errors when linking with a shared library | |
| 2250 (https://github.com/fmtlib/fmt/issues/2011). | |
| 2251 - Reintroduced ostream support to range formatters | |
| 2252 (https://github.com/fmtlib/fmt/issues/2014). | |
| 2253 - Worked around an issue with mixing std versions in gcc | |
| 2254 (https://github.com/fmtlib/fmt/issues/2017). | |
| 2255 | |
| 2256 # 7.1.2 - 2020-11-04 | |
| 2257 | |
| 2258 - Fixed floating point formatting with large precision | |
| 2259 (https://github.com/fmtlib/fmt/issues/1976). | |
| 2260 | |
| 2261 # 7.1.1 - 2020-11-01 | |
| 2262 | |
| 2263 - Fixed ABI compatibility with 7.0.x | |
| 2264 (https://github.com/fmtlib/fmt/issues/1961). | |
| 2265 - Added the `FMT_ARM_ABI_COMPATIBILITY` macro to work around ABI | |
| 2266 incompatibility between GCC and Clang on ARM | |
| 2267 (https://github.com/fmtlib/fmt/issues/1919). | |
| 2268 - Worked around a SFINAE bug in GCC 8 | |
| 2269 (https://github.com/fmtlib/fmt/issues/1957). | |
| 2270 - Fixed linkage errors when building with GCC\'s LTO | |
| 2271 (https://github.com/fmtlib/fmt/issues/1955). | |
| 2272 - Fixed a compilation error when building without `__builtin_clz` or | |
| 2273 equivalent (https://github.com/fmtlib/fmt/pull/1968). | |
| 2274 Thanks @tohammer. | |
| 2275 - Fixed a sign conversion warning | |
| 2276 (https://github.com/fmtlib/fmt/pull/1964). Thanks @OptoCloud. | |
| 2277 | |
| 2278 # 7.1.0 - 2020-10-25 | |
| 2279 | |
| 2280 - Switched from | |
| 2281 [Grisu3](https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf) | |
| 2282 to [Dragonbox](https://github.com/jk-jeon/dragonbox) for the default | |
| 2283 floating-point formatting which gives the shortest decimal | |
| 2284 representation with round-trip guarantee and correct rounding | |
| 2285 (https://github.com/fmtlib/fmt/pull/1882, | |
| 2286 https://github.com/fmtlib/fmt/pull/1887, | |
| 2287 https://github.com/fmtlib/fmt/pull/1894). This makes {fmt} | |
| 2288 up to 20-30x faster than common implementations of | |
| 2289 `std::ostringstream` and `sprintf` on | |
| 2290 [dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark) and | |
| 2291 faster than double-conversion and Ryū: | |
| 2292 | |
| 2293  | |
| 2294 | |
| 2295 It is possible to get even better performance at the cost of larger | |
| 2296 binary size by compiling with the `FMT_USE_FULL_CACHE_DRAGONBOX` | |
| 2297 macro set to 1. | |
| 2298 | |
| 2299 Thanks @jk-jeon. | |
| 2300 | |
| 2301 - Added an experimental unsynchronized file output API which, together | |
| 2302 with [format string | |
| 2303 compilation](https://fmt.dev/latest/api.html#compile-api), can give | |
| 2304 [5-9 times speed up compared to | |
| 2305 fprintf](https://www.zverovich.net/2020/08/04/optimal-file-buffer-size.html) | |
| 2306 on common platforms ([godbolt](https://godbolt.org/z/nsTcG8)): | |
| 2307 | |
| 2308 ```c++ | |
| 2309 #include <fmt/os.h> | |
| 2310 | |
| 2311 int main() { | |
| 2312 auto f = fmt::output_file("guide"); | |
| 2313 f.print("The answer is {}.", 42); | |
| 2314 } | |
| 2315 ``` | |
| 2316 | |
| 2317 - Added a formatter for `std::chrono::time_point<system_clock>` | |
| 2318 (https://github.com/fmtlib/fmt/issues/1819, | |
| 2319 https://github.com/fmtlib/fmt/pull/1837). For example | |
| 2320 ([godbolt](https://godbolt.org/z/c4M6fh)): | |
| 2321 | |
| 2322 ```c++ | |
| 2323 #include <fmt/chrono.h> | |
| 2324 | |
| 2325 int main() { | |
| 2326 auto now = std::chrono::system_clock::now(); | |
| 2327 fmt::print("The time is {:%H:%M:%S}.\n", now); | |
| 2328 } | |
| 2329 ``` | |
| 2330 | |
| 2331 Thanks @adamburgess. | |
| 2332 | |
| 2333 - Added support for ranges with non-const `begin`/`end` to `fmt::join` | |
| 2334 (https://github.com/fmtlib/fmt/issues/1784, | |
| 2335 https://github.com/fmtlib/fmt/pull/1786). For example | |
| 2336 ([godbolt](https://godbolt.org/z/jP63Tv)): | |
| 2337 | |
| 2338 ```c++ | |
| 2339 #include <fmt/ranges.h> | |
| 2340 #include <range/v3/view/filter.hpp> | |
| 2341 | |
| 2342 int main() { | |
| 2343 using std::literals::string_literals::operator""s; | |
| 2344 auto strs = std::array{"a"s, "bb"s, "ccc"s}; | |
| 2345 auto range = strs | ranges::views::filter( | |
| 2346 [] (const std::string &x) { return x.size() != 2; } | |
| 2347 ); | |
| 2348 fmt::print("{}\n", fmt::join(range, "")); | |
| 2349 } | |
| 2350 ``` | |
| 2351 | |
| 2352 prints \"accc\". | |
| 2353 | |
| 2354 Thanks @tonyelewis. | |
| 2355 | |
| 2356 - Added a `memory_buffer::append` overload that takes a range | |
| 2357 (https://github.com/fmtlib/fmt/pull/1806). Thanks @BRevzin. | |
| 2358 | |
| 2359 - Improved handling of single code units in `FMT_COMPILE`. For | |
| 2360 example: | |
| 2361 | |
| 2362 ```c++ | |
| 2363 #include <fmt/compile.h> | |
| 2364 | |
| 2365 char* f(char* buf) { | |
| 2366 return fmt::format_to(buf, FMT_COMPILE("x{}"), 42); | |
| 2367 } | |
| 2368 ``` | |
| 2369 | |
| 2370 compiles to just ([godbolt](https://godbolt.org/z/5vncz3)): | |
| 2371 | |
| 2372 ```asm | |
| 2373 _Z1fPc: | |
| 2374 movb $120, (%rdi) | |
| 2375 xorl %edx, %edx | |
| 2376 cmpl $42, _ZN3fmt2v76detail10basic_dataIvE23zero_or_powers_of_10_32E+8(%rip) | |
| 2377 movl $3, %eax | |
| 2378 seta %dl | |
| 2379 subl %edx, %eax | |
| 2380 movzwl _ZN3fmt2v76detail10basic_dataIvE6digitsE+84(%rip), %edx | |
| 2381 cltq | |
| 2382 addq %rdi, %rax | |
| 2383 movw %dx, -2(%rax) | |
| 2384 ret | |
| 2385 ``` | |
| 2386 | |
| 2387 Here a single `mov` instruction writes `'x'` (`$120`) to the output | |
| 2388 buffer. | |
| 2389 | |
| 2390 - Added dynamic width support to format string compilation | |
| 2391 (https://github.com/fmtlib/fmt/issues/1809). | |
| 2392 | |
| 2393 - Improved error reporting for unformattable types: now you\'ll get | |
| 2394 the type name directly in the error message instead of the note: | |
| 2395 | |
| 2396 ```c++ | |
| 2397 #include <fmt/core.h> | |
| 2398 | |
| 2399 struct how_about_no {}; | |
| 2400 | |
| 2401 int main() { | |
| 2402 fmt::print("{}", how_about_no()); | |
| 2403 } | |
| 2404 ``` | |
| 2405 | |
| 2406 Error ([godbolt](https://godbolt.org/z/GoxM4e)): | |
| 2407 | |
| 2408 `fmt/core.h:1438:3: error: static_assert failed due to requirement 'fmt::v7::formattable<how_about_no>()' "Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt" ...` | |
| 2409 | |
| 2410 - Added the | |
| 2411 [make_args_checked](https://fmt.dev/7.1.0/api.html#argument-lists) | |
| 2412 function template that allows you to write formatting functions with | |
| 2413 compile-time format string checks and avoid binary code bloat | |
| 2414 ([godbolt](https://godbolt.org/z/PEf9qr)): | |
| 2415 | |
| 2416 ```c++ | |
| 2417 void vlog(const char* file, int line, fmt::string_view format, | |
| 2418 fmt::format_args args) { | |
| 2419 fmt::print("{}: {}: ", file, line); | |
| 2420 fmt::vprint(format, args); | |
| 2421 } | |
| 2422 | |
| 2423 template <typename S, typename... Args> | |
| 2424 void log(const char* file, int line, const S& format, Args&&... args) { | |
| 2425 vlog(file, line, format, | |
| 2426 fmt::make_args_checked<Args...>(format, args...)); | |
| 2427 } | |
| 2428 | |
| 2429 #define MY_LOG(format, ...) \ | |
| 2430 log(__FILE__, __LINE__, FMT_STRING(format), __VA_ARGS__) | |
| 2431 | |
| 2432 MY_LOG("invalid squishiness: {}", 42); | |
| 2433 ``` | |
| 2434 | |
| 2435 - Replaced `snprintf` fallback with a faster internal IEEE 754 `float` | |
| 2436 and `double` formatter for arbitrary precision. For example | |
| 2437 ([godbolt](https://godbolt.org/z/dPhWvj)): | |
| 2438 | |
| 2439 ```c++ | |
| 2440 #include <fmt/core.h> | |
| 2441 | |
| 2442 int main() { | |
| 2443 fmt::print("{:.500}\n", 4.9406564584124654E-324); | |
| 2444 } | |
| 2445 ``` | |
| 2446 | |
| 2447 prints | |
| 2448 | |
| 2449 `4.9406564584124654417656879286822137236505980261432476442558568250067550727020875186529983636163599237979656469544571773092665671035593979639877479601078187812630071319031140452784581716784898210368871863605699873072305000638740915356498438731247339727316961514003171538539807412623856559117102665855668676818703956031062493194527159149245532930545654440112748012970999954193198940908041656332452475714786901472678015935523861155013480352649347201937902681071074917033322268447533357208324319360923829e-324`. | |
| 2450 | |
| 2451 - Made `format_to_n` and `formatted_size` part of the [core | |
| 2452 API](https://fmt.dev/latest/api.html#core-api) | |
| 2453 ([godbolt](https://godbolt.org/z/sPjY1K)): | |
| 2454 | |
| 2455 ```c++ | |
| 2456 #include <fmt/core.h> | |
| 2457 | |
| 2458 int main() { | |
| 2459 char buffer[10]; | |
| 2460 auto result = fmt::format_to_n(buffer, sizeof(buffer), "{}", 42); | |
| 2461 } | |
| 2462 ``` | |
| 2463 | |
| 2464 - Added `fmt::format_to_n` overload with format string compilation | |
| 2465 (https://github.com/fmtlib/fmt/issues/1764, | |
| 2466 https://github.com/fmtlib/fmt/pull/1767, | |
| 2467 https://github.com/fmtlib/fmt/pull/1869). For example | |
| 2468 ([godbolt](https://godbolt.org/z/93h86q)): | |
| 2469 | |
| 2470 ```c++ | |
| 2471 #include <fmt/compile.h> | |
| 2472 | |
| 2473 int main() { | |
| 2474 char buffer[8]; | |
| 2475 fmt::format_to_n(buffer, sizeof(buffer), FMT_COMPILE("{}"), 42); | |
| 2476 } | |
| 2477 ``` | |
| 2478 | |
| 2479 Thanks @Kurkin and @alexezeder. | |
| 2480 | |
| 2481 - Added `fmt::format_to` overload that take `text_style` | |
| 2482 (https://github.com/fmtlib/fmt/issues/1593, | |
| 2483 https://github.com/fmtlib/fmt/issues/1842, | |
| 2484 https://github.com/fmtlib/fmt/pull/1843). For example | |
| 2485 ([godbolt](https://godbolt.org/z/91153r)): | |
| 2486 | |
| 2487 ```c++ | |
| 2488 #include <fmt/color.h> | |
| 2489 | |
| 2490 int main() { | |
| 2491 std::string out; | |
| 2492 fmt::format_to(std::back_inserter(out), | |
| 2493 fmt::emphasis::bold | fg(fmt::color::red), | |
| 2494 "The answer is {}.", 42); | |
| 2495 } | |
| 2496 ``` | |
| 2497 | |
| 2498 Thanks @Naios. | |
| 2499 | |
| 2500 - Made the `'#'` specifier emit trailing zeros in addition to the | |
| 2501 decimal point (https://github.com/fmtlib/fmt/issues/1797). | |
| 2502 For example ([godbolt](https://godbolt.org/z/bhdcW9)): | |
| 2503 | |
| 2504 ```c++ | |
| 2505 #include <fmt/core.h> | |
| 2506 | |
| 2507 int main() { | |
| 2508 fmt::print("{:#.2g}", 0.5); | |
| 2509 } | |
| 2510 ``` | |
| 2511 | |
| 2512 prints `0.50`. | |
| 2513 | |
| 2514 - Changed the default floating point format to not include `.0` for | |
| 2515 consistency with `std::format` and `std::to_chars` | |
| 2516 (https://github.com/fmtlib/fmt/issues/1893, | |
| 2517 https://github.com/fmtlib/fmt/issues/1943). It is possible | |
| 2518 to get the decimal point and trailing zero with the `#` specifier. | |
| 2519 | |
| 2520 - Fixed an issue with floating-point formatting that could result in | |
| 2521 addition of a non-significant trailing zero in rare cases e.g. | |
| 2522 `1.00e-34` instead of `1.0e-34` | |
| 2523 (https://github.com/fmtlib/fmt/issues/1873, | |
| 2524 https://github.com/fmtlib/fmt/issues/1917). | |
| 2525 | |
| 2526 - Made `fmt::to_string` fallback on `ostream` insertion operator if | |
| 2527 the `formatter` specialization is not provided | |
| 2528 (https://github.com/fmtlib/fmt/issues/1815, | |
| 2529 https://github.com/fmtlib/fmt/pull/1829). Thanks @alexezeder. | |
| 2530 | |
| 2531 - Added support for the append mode to the experimental file API and | |
| 2532 improved `fcntl.h` detection. | |
| 2533 (https://github.com/fmtlib/fmt/pull/1847, | |
| 2534 https://github.com/fmtlib/fmt/pull/1848). Thanks @t-wiser. | |
| 2535 | |
| 2536 - Fixed handling of types that have both an implicit conversion | |
| 2537 operator and an overloaded `ostream` insertion operator | |
| 2538 (https://github.com/fmtlib/fmt/issues/1766). | |
| 2539 | |
| 2540 - Fixed a slicing issue in an internal iterator type | |
| 2541 (https://github.com/fmtlib/fmt/pull/1822). Thanks @BRevzin. | |
| 2542 | |
| 2543 - Fixed an issue in locale-specific integer formatting | |
| 2544 (https://github.com/fmtlib/fmt/issues/1927). | |
| 2545 | |
| 2546 - Fixed handling of exotic code unit types | |
| 2547 (https://github.com/fmtlib/fmt/issues/1870, | |
| 2548 https://github.com/fmtlib/fmt/issues/1932). | |
| 2549 | |
| 2550 - Improved `FMT_ALWAYS_INLINE` | |
| 2551 (https://github.com/fmtlib/fmt/pull/1878). Thanks @jk-jeon. | |
| 2552 | |
| 2553 - Removed dependency on `windows.h` | |
| 2554 (https://github.com/fmtlib/fmt/pull/1900). Thanks @bernd5. | |
| 2555 | |
| 2556 - Optimized counting of decimal digits on MSVC | |
| 2557 (https://github.com/fmtlib/fmt/pull/1890). Thanks @mwinterb. | |
| 2558 | |
| 2559 - Improved documentation | |
| 2560 (https://github.com/fmtlib/fmt/issues/1772, | |
| 2561 https://github.com/fmtlib/fmt/pull/1775, | |
| 2562 https://github.com/fmtlib/fmt/pull/1792, | |
| 2563 https://github.com/fmtlib/fmt/pull/1838, | |
| 2564 https://github.com/fmtlib/fmt/pull/1888, | |
| 2565 https://github.com/fmtlib/fmt/pull/1918, | |
| 2566 https://github.com/fmtlib/fmt/pull/1939). | |
| 2567 Thanks @leolchat, @pepsiman, @Klaim, @ravijanjam, @francesco-st and @udnaan. | |
| 2568 | |
| 2569 - Added the `FMT_REDUCE_INT_INSTANTIATIONS` CMake option that reduces | |
| 2570 the binary code size at the cost of some integer formatting | |
| 2571 performance. This can be useful for extremely memory-constrained | |
| 2572 embedded systems | |
| 2573 (https://github.com/fmtlib/fmt/issues/1778, | |
| 2574 https://github.com/fmtlib/fmt/pull/1781). Thanks @kammce. | |
| 2575 | |
| 2576 - Added the `FMT_USE_INLINE_NAMESPACES` macro to control usage of | |
| 2577 inline namespaces | |
| 2578 (https://github.com/fmtlib/fmt/pull/1945). Thanks @darklukee. | |
| 2579 | |
| 2580 - Improved build configuration | |
| 2581 (https://github.com/fmtlib/fmt/pull/1760, | |
| 2582 https://github.com/fmtlib/fmt/pull/1770, | |
| 2583 https://github.com/fmtlib/fmt/issues/1779, | |
| 2584 https://github.com/fmtlib/fmt/pull/1783, | |
| 2585 https://github.com/fmtlib/fmt/pull/1823). | |
| 2586 Thanks @dvetutnev, @xvitaly, @tambry, @medithe and @martinwuehrer. | |
| 2587 | |
| 2588 - Fixed various warnings and compilation issues | |
| 2589 (https://github.com/fmtlib/fmt/pull/1790, | |
| 2590 https://github.com/fmtlib/fmt/pull/1802, | |
| 2591 https://github.com/fmtlib/fmt/pull/1808, | |
| 2592 https://github.com/fmtlib/fmt/issues/1810, | |
| 2593 https://github.com/fmtlib/fmt/issues/1811, | |
| 2594 https://github.com/fmtlib/fmt/pull/1812, | |
| 2595 https://github.com/fmtlib/fmt/pull/1814, | |
| 2596 https://github.com/fmtlib/fmt/pull/1816, | |
| 2597 https://github.com/fmtlib/fmt/pull/1817, | |
| 2598 https://github.com/fmtlib/fmt/pull/1818, | |
| 2599 https://github.com/fmtlib/fmt/issues/1825, | |
| 2600 https://github.com/fmtlib/fmt/pull/1836, | |
| 2601 https://github.com/fmtlib/fmt/pull/1855, | |
| 2602 https://github.com/fmtlib/fmt/pull/1856, | |
| 2603 https://github.com/fmtlib/fmt/pull/1860, | |
| 2604 https://github.com/fmtlib/fmt/pull/1877, | |
| 2605 https://github.com/fmtlib/fmt/pull/1879, | |
| 2606 https://github.com/fmtlib/fmt/pull/1880, | |
| 2607 https://github.com/fmtlib/fmt/issues/1896, | |
| 2608 https://github.com/fmtlib/fmt/pull/1897, | |
| 2609 https://github.com/fmtlib/fmt/pull/1898, | |
| 2610 https://github.com/fmtlib/fmt/issues/1904, | |
| 2611 https://github.com/fmtlib/fmt/pull/1908, | |
| 2612 https://github.com/fmtlib/fmt/issues/1911, | |
| 2613 https://github.com/fmtlib/fmt/issues/1912, | |
| 2614 https://github.com/fmtlib/fmt/issues/1928, | |
| 2615 https://github.com/fmtlib/fmt/pull/1929, | |
| 2616 https://github.com/fmtlib/fmt/issues/1935, | |
| 2617 https://github.com/fmtlib/fmt/pull/1937, | |
| 2618 https://github.com/fmtlib/fmt/pull/1942, | |
| 2619 https://github.com/fmtlib/fmt/issues/1949). | |
| 2620 Thanks @TheQwertiest, @medithe, @martinwuehrer, @n16h7hunt3r, @Othereum, | |
| 2621 @gsjaardema, @AlexanderLanin, @gcerretani, @chronoxor, @noizefloor, | |
| 2622 @akohlmey, @jk-jeon, @rimathia, @rglarix, @moiwi, @heckad, @MarcDirven. | |
| 2623 @BartSiwek and @darklukee. | |
| 2624 | |
| 2625 # 7.0.3 - 2020-08-06 | |
| 2626 | |
| 2627 - Worked around broken `numeric_limits` for 128-bit integers | |
| 2628 (https://github.com/fmtlib/fmt/issues/1787). | |
| 2629 - Added error reporting on missing named arguments | |
| 2630 (https://github.com/fmtlib/fmt/issues/1796). | |
| 2631 - Stopped using 128-bit integers with clang-cl | |
| 2632 (https://github.com/fmtlib/fmt/pull/1800). Thanks @Kingcom. | |
| 2633 - Fixed issues in locale-specific integer formatting | |
| 2634 (https://github.com/fmtlib/fmt/issues/1782, | |
| 2635 https://github.com/fmtlib/fmt/issues/1801). | |
| 2636 | |
| 2637 # 7.0.2 - 2020-07-29 | |
| 2638 | |
| 2639 - Worked around broken `numeric_limits` for 128-bit integers | |
| 2640 (https://github.com/fmtlib/fmt/issues/1725). | |
| 2641 - Fixed compatibility with CMake 3.4 | |
| 2642 (https://github.com/fmtlib/fmt/issues/1779). | |
| 2643 - Fixed handling of digit separators in locale-specific formatting | |
| 2644 (https://github.com/fmtlib/fmt/issues/1782). | |
| 2645 | |
| 2646 # 7.0.1 - 2020-07-07 | |
| 2647 | |
| 2648 - Updated the inline version namespace name. | |
| 2649 - Worked around a gcc bug in mangling of alias templates | |
| 2650 (https://github.com/fmtlib/fmt/issues/1753). | |
| 2651 - Fixed a linkage error on Windows | |
| 2652 (https://github.com/fmtlib/fmt/issues/1757). Thanks @Kurkin. | |
| 2653 - Fixed minor issues with the documentation. | |
| 2654 | |
| 2655 # 7.0.0 - 2020-07-05 | |
| 2656 | |
| 2657 - Reduced the library size. For example, on macOS a stripped test | |
| 2658 binary statically linked with {fmt} [shrank from \~368k to less than | |
| 2659 100k](http://www.zverovich.net/2020/05/21/reducing-library-size.html). | |
| 2660 | |
| 2661 - Added a simpler and more efficient [format string compilation | |
| 2662 API](https://fmt.dev/7.0.0/api.html#compile-api): | |
| 2663 | |
| 2664 ```c++ | |
| 2665 #include <fmt/compile.h> | |
| 2666 | |
| 2667 // Converts 42 into std::string using the most efficient method and no | |
| 2668 // runtime format string processing. | |
| 2669 std::string s = fmt::format(FMT_COMPILE("{}"), 42); | |
| 2670 ``` | |
| 2671 | |
| 2672 The old `fmt::compile` API is now deprecated. | |
| 2673 | |
| 2674 - Optimized integer formatting: `format_to` with format string | |
| 2675 compilation and a stack-allocated buffer is now [faster than | |
| 2676 to_chars on both libc++ and | |
| 2677 libstdc++](http://www.zverovich.net/2020/06/13/fast-int-to-string-revisited.html). | |
| 2678 | |
| 2679 - Optimized handling of small format strings. For example, | |
| 2680 | |
| 2681 ```c++ | |
| 2682 fmt::format("Result: {}: ({},{},{},{})", str1, str2, str3, str4, str5) | |
| 2683 ``` | |
| 2684 | |
| 2685 is now \~40% faster | |
| 2686 (https://github.com/fmtlib/fmt/issues/1685). | |
| 2687 | |
| 2688 - Applied extern templates to improve compile times when using the | |
| 2689 core API and `fmt/format.h` | |
| 2690 (https://github.com/fmtlib/fmt/issues/1452). For example, | |
| 2691 on macOS with clang the compile time of a test translation unit | |
| 2692 dropped from 2.3s to 0.3s with `-O2` and from 0.6s to 0.3s with the | |
| 2693 default settings (`-O0`). | |
| 2694 | |
| 2695 Before (`-O2`): | |
| 2696 | |
| 2697 % time c++ -c test.cc -I include -std=c++17 -O2 | |
| 2698 c++ -c test.cc -I include -std=c++17 -O2 2.22s user 0.08s system 99% cpu 2.311 total | |
| 2699 | |
| 2700 After (`-O2`): | |
| 2701 | |
| 2702 % time c++ -c test.cc -I include -std=c++17 -O2 | |
| 2703 c++ -c test.cc -I include -std=c++17 -O2 0.26s user 0.04s system 98% cpu 0.303 total | |
| 2704 | |
| 2705 Before (default): | |
| 2706 | |
| 2707 % time c++ -c test.cc -I include -std=c++17 | |
| 2708 c++ -c test.cc -I include -std=c++17 0.53s user 0.06s system 98% cpu 0.601 total | |
| 2709 | |
| 2710 After (default): | |
| 2711 | |
| 2712 % time c++ -c test.cc -I include -std=c++17 | |
| 2713 c++ -c test.cc -I include -std=c++17 0.24s user 0.06s system 98% cpu 0.301 total | |
| 2714 | |
| 2715 It is still recommended to use `fmt/core.h` instead of | |
| 2716 `fmt/format.h` but the compile time difference is now smaller. | |
| 2717 Thanks @alex3d for the suggestion. | |
| 2718 | |
| 2719 - Named arguments are now stored on stack (no dynamic memory | |
| 2720 allocations) and the compiled code is more compact and efficient. | |
| 2721 For example | |
| 2722 | |
| 2723 ```c++ | |
| 2724 #include <fmt/core.h> | |
| 2725 | |
| 2726 int main() { | |
| 2727 fmt::print("The answer is {answer}\n", fmt::arg("answer", 42)); | |
| 2728 } | |
| 2729 ``` | |
| 2730 | |
| 2731 compiles to just ([godbolt](https://godbolt.org/z/NcfEp_)) | |
| 2732 | |
| 2733 ```asm | |
| 2734 .LC0: | |
| 2735 .string "answer" | |
| 2736 .LC1: | |
| 2737 .string "The answer is {answer}\n" | |
| 2738 main: | |
| 2739 sub rsp, 56 | |
| 2740 mov edi, OFFSET FLAT:.LC1 | |
| 2741 mov esi, 23 | |
| 2742 movabs rdx, 4611686018427387905 | |
| 2743 lea rax, [rsp+32] | |
| 2744 lea rcx, [rsp+16] | |
| 2745 mov QWORD PTR [rsp+8], 1 | |
| 2746 mov QWORD PTR [rsp], rax | |
| 2747 mov DWORD PTR [rsp+16], 42 | |
| 2748 mov QWORD PTR [rsp+32], OFFSET FLAT:.LC0 | |
| 2749 mov DWORD PTR [rsp+40], 0 | |
| 2750 call fmt::v6::vprint(fmt::v6::basic_string_view<char>, | |
| 2751 fmt::v6::format_args) | |
| 2752 xor eax, eax | |
| 2753 add rsp, 56 | |
| 2754 ret | |
| 2755 | |
| 2756 .L.str.1: | |
| 2757 .asciz "answer" | |
| 2758 ``` | |
| 2759 | |
| 2760 - Implemented compile-time checks for dynamic width and precision | |
| 2761 (https://github.com/fmtlib/fmt/issues/1614): | |
| 2762 | |
| 2763 ```c++ | |
| 2764 #include <fmt/format.h> | |
| 2765 | |
| 2766 int main() { | |
| 2767 fmt::print(FMT_STRING("{0:{1}}"), 42); | |
| 2768 } | |
| 2769 ``` | |
| 2770 | |
| 2771 now gives a compilation error because argument 1 doesn\'t exist: | |
| 2772 | |
| 2773 In file included from test.cc:1: | |
| 2774 include/fmt/format.h:2726:27: error: constexpr variable 'invalid_format' must be | |
| 2775 initialized by a constant expression | |
| 2776 FMT_CONSTEXPR_DECL bool invalid_format = | |
| 2777 ^ | |
| 2778 ... | |
| 2779 include/fmt/core.h:569:26: note: in call to | |
| 2780 '&checker(s, {}).context_->on_error(&"argument not found"[0])' | |
| 2781 if (id >= num_args_) on_error("argument not found"); | |
| 2782 ^ | |
| 2783 | |
| 2784 - Added sentinel support to `fmt::join` | |
| 2785 (https://github.com/fmtlib/fmt/pull/1689) | |
| 2786 | |
| 2787 ```c++ | |
| 2788 struct zstring_sentinel {}; | |
| 2789 bool operator==(const char* p, zstring_sentinel) { return *p == '\0'; } | |
| 2790 bool operator!=(const char* p, zstring_sentinel) { return *p != '\0'; } | |
| 2791 | |
| 2792 struct zstring { | |
| 2793 const char* p; | |
| 2794 const char* begin() const { return p; } | |
| 2795 zstring_sentinel end() const { return {}; } | |
| 2796 }; | |
| 2797 | |
| 2798 auto s = fmt::format("{}", fmt::join(zstring{"hello"}, "_")); | |
| 2799 // s == "h_e_l_l_o" | |
| 2800 ``` | |
| 2801 | |
| 2802 Thanks @BRevzin. | |
| 2803 | |
| 2804 - Added support for named arguments, `clear` and `reserve` to | |
| 2805 `dynamic_format_arg_store` | |
| 2806 (https://github.com/fmtlib/fmt/issues/1655, | |
| 2807 https://github.com/fmtlib/fmt/pull/1663, | |
| 2808 https://github.com/fmtlib/fmt/pull/1674, | |
| 2809 https://github.com/fmtlib/fmt/pull/1677). Thanks @vsolontsov-ll. | |
| 2810 | |
| 2811 - Added support for the `'c'` format specifier to integral types for | |
| 2812 compatibility with `std::format` | |
| 2813 (https://github.com/fmtlib/fmt/issues/1652). | |
| 2814 | |
| 2815 - Replaced the `'n'` format specifier with `'L'` for compatibility | |
| 2816 with `std::format` | |
| 2817 (https://github.com/fmtlib/fmt/issues/1624). The `'n'` | |
| 2818 specifier can be enabled via the `FMT_DEPRECATED_N_SPECIFIER` macro. | |
| 2819 | |
| 2820 - The `'='` format specifier is now disabled by default for | |
| 2821 compatibility with `std::format`. It can be enabled via the | |
| 2822 `FMT_DEPRECATED_NUMERIC_ALIGN` macro. | |
| 2823 | |
| 2824 - Removed the following deprecated APIs: | |
| 2825 | |
| 2826 - `FMT_STRING_ALIAS` and `fmt` macros - replaced by `FMT_STRING` | |
| 2827 - `fmt::basic_string_view::char_type` - replaced by | |
| 2828 `fmt::basic_string_view::value_type` | |
| 2829 - `convert_to_int` | |
| 2830 - `format_arg_store::types` | |
| 2831 - `*parse_context` - replaced by `*format_parse_context` | |
| 2832 - `FMT_DEPRECATED_INCLUDE_OS` | |
| 2833 - `FMT_DEPRECATED_PERCENT` - incompatible with `std::format` | |
| 2834 - `*writer` - replaced by compiled format API | |
| 2835 | |
| 2836 - Renamed the `internal` namespace to `detail` | |
| 2837 (https://github.com/fmtlib/fmt/issues/1538). The former is | |
| 2838 still provided as an alias if the `FMT_USE_INTERNAL` macro is | |
| 2839 defined. | |
| 2840 | |
| 2841 - Improved compatibility between `fmt::printf` with the standard specs | |
| 2842 (https://github.com/fmtlib/fmt/issues/1595, | |
| 2843 https://github.com/fmtlib/fmt/pull/1682, | |
| 2844 https://github.com/fmtlib/fmt/pull/1683, | |
| 2845 https://github.com/fmtlib/fmt/pull/1687, | |
| 2846 https://github.com/fmtlib/fmt/pull/1699). Thanks @rimathia. | |
| 2847 | |
| 2848 - Fixed handling of `operator<<` overloads that use `copyfmt` | |
| 2849 (https://github.com/fmtlib/fmt/issues/1666). | |
| 2850 | |
| 2851 - Added the `FMT_OS` CMake option to control inclusion of OS-specific | |
| 2852 APIs in the fmt target. This can be useful for embedded platforms | |
| 2853 (https://github.com/fmtlib/fmt/issues/1654, | |
| 2854 https://github.com/fmtlib/fmt/pull/1656). Thanks @kwesolowski. | |
| 2855 | |
| 2856 - Replaced `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` with the | |
| 2857 `FMT_FUZZ` macro to prevent interfering with fuzzing of projects | |
| 2858 using {fmt} (https://github.com/fmtlib/fmt/pull/1650). | |
| 2859 Thanks @asraa. | |
| 2860 | |
| 2861 - Fixed compatibility with emscripten | |
| 2862 (https://github.com/fmtlib/fmt/issues/1636, | |
| 2863 https://github.com/fmtlib/fmt/pull/1637). Thanks @ArthurSonzogni. | |
| 2864 | |
| 2865 - Improved documentation | |
| 2866 (https://github.com/fmtlib/fmt/issues/704, | |
| 2867 https://github.com/fmtlib/fmt/pull/1643, | |
| 2868 https://github.com/fmtlib/fmt/pull/1660, | |
| 2869 https://github.com/fmtlib/fmt/pull/1681, | |
| 2870 https://github.com/fmtlib/fmt/pull/1691, | |
| 2871 https://github.com/fmtlib/fmt/pull/1706, | |
| 2872 https://github.com/fmtlib/fmt/pull/1714, | |
| 2873 https://github.com/fmtlib/fmt/pull/1721, | |
| 2874 https://github.com/fmtlib/fmt/pull/1739, | |
| 2875 https://github.com/fmtlib/fmt/pull/1740, | |
| 2876 https://github.com/fmtlib/fmt/pull/1741, | |
| 2877 https://github.com/fmtlib/fmt/pull/1751). | |
| 2878 Thanks @senior7515, @lsr0, @puetzk, @fpelliccioni, Alexey Kuzmenko, @jelly, | |
| 2879 @claremacrae, @jiapengwen, @gsjaardema and @alexey-milovidov. | |
| 2880 | |
| 2881 - Implemented various build configuration fixes and improvements | |
| 2882 (https://github.com/fmtlib/fmt/pull/1603, | |
| 2883 https://github.com/fmtlib/fmt/pull/1657, | |
| 2884 https://github.com/fmtlib/fmt/pull/1702, | |
| 2885 https://github.com/fmtlib/fmt/pull/1728). | |
| 2886 Thanks @scramsby, @jtojnar, @orivej and @flagarde. | |
| 2887 | |
| 2888 - Fixed various warnings and compilation issues | |
| 2889 (https://github.com/fmtlib/fmt/pull/1616, | |
| 2890 https://github.com/fmtlib/fmt/issues/1620, | |
| 2891 https://github.com/fmtlib/fmt/issues/1622, | |
| 2892 https://github.com/fmtlib/fmt/issues/1625, | |
| 2893 https://github.com/fmtlib/fmt/pull/1627, | |
| 2894 https://github.com/fmtlib/fmt/issues/1628, | |
| 2895 https://github.com/fmtlib/fmt/pull/1629, | |
| 2896 https://github.com/fmtlib/fmt/issues/1631, | |
| 2897 https://github.com/fmtlib/fmt/pull/1633, | |
| 2898 https://github.com/fmtlib/fmt/pull/1649, | |
| 2899 https://github.com/fmtlib/fmt/issues/1658, | |
| 2900 https://github.com/fmtlib/fmt/pull/1661, | |
| 2901 https://github.com/fmtlib/fmt/pull/1667, | |
| 2902 https://github.com/fmtlib/fmt/issues/1668, | |
| 2903 https://github.com/fmtlib/fmt/pull/1669, | |
| 2904 https://github.com/fmtlib/fmt/issues/1692, | |
| 2905 https://github.com/fmtlib/fmt/pull/1696, | |
| 2906 https://github.com/fmtlib/fmt/pull/1697, | |
| 2907 https://github.com/fmtlib/fmt/issues/1707, | |
| 2908 https://github.com/fmtlib/fmt/pull/1712, | |
| 2909 https://github.com/fmtlib/fmt/pull/1716, | |
| 2910 https://github.com/fmtlib/fmt/pull/1722, | |
| 2911 https://github.com/fmtlib/fmt/issues/1724, | |
| 2912 https://github.com/fmtlib/fmt/pull/1729, | |
| 2913 https://github.com/fmtlib/fmt/pull/1738, | |
| 2914 https://github.com/fmtlib/fmt/issues/1742, | |
| 2915 https://github.com/fmtlib/fmt/issues/1743, | |
| 2916 https://github.com/fmtlib/fmt/pull/1744, | |
| 2917 https://github.com/fmtlib/fmt/issues/1747, | |
| 2918 https://github.com/fmtlib/fmt/pull/1750). | |
| 2919 Thanks @gsjaardema, @gabime, @johnor, @Kurkin, @invexed, @peterbell10, | |
| 2920 @daixtrose, @petrutlucian94, @Neargye, @ambitslix, @gabime, @erthink, | |
| 2921 @tohammer and @0x8000-0000. | |
| 2922 | |
| 2923 # 6.2.1 - 2020-05-09 | |
| 2924 | |
| 2925 - Fixed ostream support in `sprintf` | |
| 2926 (https://github.com/fmtlib/fmt/issues/1631). | |
| 2927 - Fixed type detection when using implicit conversion to `string_view` | |
| 2928 and ostream `operator<<` inconsistently | |
| 2929 (https://github.com/fmtlib/fmt/issues/1662). | |
| 2930 | |
| 2931 # 6.2.0 - 2020-04-05 | |
| 2932 | |
| 2933 - Improved error reporting when trying to format an object of a | |
| 2934 non-formattable type: | |
| 2935 | |
| 2936 ```c++ | |
| 2937 fmt::format("{}", S()); | |
| 2938 ``` | |
| 2939 | |
| 2940 now gives: | |
| 2941 | |
| 2942 include/fmt/core.h:1015:5: error: static_assert failed due to requirement | |
| 2943 'formattable' "Cannot format argument. To make type T formattable provide a | |
| 2944 formatter<T> specialization: | |
| 2945 https://fmt.dev/latest/api.html#formatting-user-defined-types" | |
| 2946 static_assert( | |
| 2947 ^ | |
| 2948 ... | |
| 2949 note: in instantiation of function template specialization | |
| 2950 'fmt::v6::format<char [3], S, char>' requested here | |
| 2951 fmt::format("{}", S()); | |
| 2952 ^ | |
| 2953 | |
| 2954 if `S` is not formattable. | |
| 2955 | |
| 2956 - Reduced the library size by \~10%. | |
| 2957 | |
| 2958 - Always print decimal point if `#` is specified | |
| 2959 (https://github.com/fmtlib/fmt/issues/1476, | |
| 2960 https://github.com/fmtlib/fmt/issues/1498): | |
| 2961 | |
| 2962 ```c++ | |
| 2963 fmt::print("{:#.0f}", 42.0); | |
| 2964 ``` | |
| 2965 | |
| 2966 now prints `42.` | |
| 2967 | |
| 2968 - Implemented the `'L'` specifier for locale-specific numeric | |
| 2969 formatting to improve compatibility with `std::format`. The `'n'` | |
| 2970 specifier is now deprecated and will be removed in the next major | |
| 2971 release. | |
| 2972 | |
| 2973 - Moved OS-specific APIs such as `windows_error` from `fmt/format.h` | |
| 2974 to `fmt/os.h`. You can define `FMT_DEPRECATED_INCLUDE_OS` to | |
| 2975 automatically include `fmt/os.h` from `fmt/format.h` for | |
| 2976 compatibility but this will be disabled in the next major release. | |
| 2977 | |
| 2978 - Added precision overflow detection in floating-point formatting. | |
| 2979 | |
| 2980 - Implemented detection of invalid use of `fmt::arg`. | |
| 2981 | |
| 2982 - Used `type_identity` to block unnecessary template argument | |
| 2983 deduction. Thanks Tim Song. | |
| 2984 | |
| 2985 - Improved UTF-8 handling | |
| 2986 (https://github.com/fmtlib/fmt/issues/1109): | |
| 2987 | |
| 2988 ```c++ | |
| 2989 fmt::print("┌{0:─^{2}}┐\n" | |
| 2990 "│{1: ^{2}}│\n" | |
| 2991 "└{0:─^{2}}┘\n", "", "Привет, мир!", 20); | |
| 2992 ``` | |
| 2993 | |
| 2994 now prints: | |
| 2995 | |
| 2996 ┌────────────────────┐ | |
| 2997 │ Привет, мир! │ | |
| 2998 └────────────────────┘ | |
| 2999 | |
| 3000 on systems that support Unicode. | |
| 3001 | |
| 3002 - Added experimental dynamic argument storage | |
| 3003 (https://github.com/fmtlib/fmt/issues/1170, | |
| 3004 https://github.com/fmtlib/fmt/pull/1584): | |
| 3005 | |
| 3006 ```c++ | |
| 3007 fmt::dynamic_format_arg_store<fmt::format_context> store; | |
| 3008 store.push_back("answer"); | |
| 3009 store.push_back(42); | |
| 3010 fmt::vprint("The {} is {}.\n", store); | |
| 3011 ``` | |
| 3012 | |
| 3013 prints: | |
| 3014 | |
| 3015 The answer is 42. | |
| 3016 | |
| 3017 Thanks @vsolontsov-ll. | |
| 3018 | |
| 3019 - Made `fmt::join` accept `initializer_list` | |
| 3020 (https://github.com/fmtlib/fmt/pull/1591). Thanks @Rapotkinnik. | |
| 3021 | |
| 3022 - Fixed handling of empty tuples | |
| 3023 (https://github.com/fmtlib/fmt/issues/1588). | |
| 3024 | |
| 3025 - Fixed handling of output iterators in `format_to_n` | |
| 3026 (https://github.com/fmtlib/fmt/issues/1506). | |
| 3027 | |
| 3028 - Fixed formatting of `std::chrono::duration` types to wide output | |
| 3029 (https://github.com/fmtlib/fmt/pull/1533). Thanks @zeffy. | |
| 3030 | |
| 3031 - Added const `begin` and `end` overload to buffers | |
| 3032 (https://github.com/fmtlib/fmt/pull/1553). Thanks @dominicpoeschko. | |
| 3033 | |
| 3034 - Added the ability to disable floating-point formatting via | |
| 3035 `FMT_USE_FLOAT`, `FMT_USE_DOUBLE` and `FMT_USE_LONG_DOUBLE` macros | |
| 3036 for extremely memory-constrained embedded system | |
| 3037 (https://github.com/fmtlib/fmt/pull/1590). Thanks @albaguirre. | |
| 3038 | |
| 3039 - Made `FMT_STRING` work with `constexpr` `string_view` | |
| 3040 (https://github.com/fmtlib/fmt/pull/1589). Thanks @scramsby. | |
| 3041 | |
| 3042 - Implemented a minor optimization in the format string parser | |
| 3043 (https://github.com/fmtlib/fmt/pull/1560). Thanks @IkarusDeveloper. | |
| 3044 | |
| 3045 - Improved attribute detection | |
| 3046 (https://github.com/fmtlib/fmt/pull/1469, | |
| 3047 https://github.com/fmtlib/fmt/pull/1475, | |
| 3048 https://github.com/fmtlib/fmt/pull/1576). | |
| 3049 Thanks @federico-busato, @chronoxor and @refnum. | |
| 3050 | |
| 3051 - Improved documentation | |
| 3052 (https://github.com/fmtlib/fmt/pull/1481, | |
| 3053 https://github.com/fmtlib/fmt/pull/1523). | |
| 3054 Thanks @JackBoosY and @imba-tjd. | |
| 3055 | |
| 3056 - Fixed symbol visibility on Linux when compiling with | |
| 3057 `-fvisibility=hidden` | |
| 3058 (https://github.com/fmtlib/fmt/pull/1535). Thanks @milianw. | |
| 3059 | |
| 3060 - Implemented various build configuration fixes and improvements | |
| 3061 (https://github.com/fmtlib/fmt/issues/1264, | |
| 3062 https://github.com/fmtlib/fmt/issues/1460, | |
| 3063 https://github.com/fmtlib/fmt/pull/1534, | |
| 3064 https://github.com/fmtlib/fmt/issues/1536, | |
| 3065 https://github.com/fmtlib/fmt/issues/1545, | |
| 3066 https://github.com/fmtlib/fmt/pull/1546, | |
| 3067 https://github.com/fmtlib/fmt/issues/1566, | |
| 3068 https://github.com/fmtlib/fmt/pull/1582, | |
| 3069 https://github.com/fmtlib/fmt/issues/1597, | |
| 3070 https://github.com/fmtlib/fmt/pull/1598). | |
| 3071 Thanks @ambitslix, @jwillikers and @stac47. | |
| 3072 | |
| 3073 - Fixed various warnings and compilation issues | |
| 3074 (https://github.com/fmtlib/fmt/pull/1433, | |
| 3075 https://github.com/fmtlib/fmt/issues/1461, | |
| 3076 https://github.com/fmtlib/fmt/pull/1470, | |
| 3077 https://github.com/fmtlib/fmt/pull/1480, | |
| 3078 https://github.com/fmtlib/fmt/pull/1485, | |
| 3079 https://github.com/fmtlib/fmt/pull/1492, | |
| 3080 https://github.com/fmtlib/fmt/issues/1493, | |
| 3081 https://github.com/fmtlib/fmt/issues/1504, | |
| 3082 https://github.com/fmtlib/fmt/pull/1505, | |
| 3083 https://github.com/fmtlib/fmt/pull/1512, | |
| 3084 https://github.com/fmtlib/fmt/issues/1515, | |
| 3085 https://github.com/fmtlib/fmt/pull/1516, | |
| 3086 https://github.com/fmtlib/fmt/pull/1518, | |
| 3087 https://github.com/fmtlib/fmt/pull/1519, | |
| 3088 https://github.com/fmtlib/fmt/pull/1520, | |
| 3089 https://github.com/fmtlib/fmt/pull/1521, | |
| 3090 https://github.com/fmtlib/fmt/pull/1522, | |
| 3091 https://github.com/fmtlib/fmt/issues/1524, | |
| 3092 https://github.com/fmtlib/fmt/pull/1530, | |
| 3093 https://github.com/fmtlib/fmt/issues/1531, | |
| 3094 https://github.com/fmtlib/fmt/pull/1532, | |
| 3095 https://github.com/fmtlib/fmt/issues/1539, | |
| 3096 https://github.com/fmtlib/fmt/issues/1547, | |
| 3097 https://github.com/fmtlib/fmt/issues/1548, | |
| 3098 https://github.com/fmtlib/fmt/pull/1554, | |
| 3099 https://github.com/fmtlib/fmt/issues/1567, | |
| 3100 https://github.com/fmtlib/fmt/pull/1568, | |
| 3101 https://github.com/fmtlib/fmt/pull/1569, | |
| 3102 https://github.com/fmtlib/fmt/pull/1571, | |
| 3103 https://github.com/fmtlib/fmt/pull/1573, | |
| 3104 https://github.com/fmtlib/fmt/pull/1575, | |
| 3105 https://github.com/fmtlib/fmt/pull/1581, | |
| 3106 https://github.com/fmtlib/fmt/issues/1583, | |
| 3107 https://github.com/fmtlib/fmt/issues/1586, | |
| 3108 https://github.com/fmtlib/fmt/issues/1587, | |
| 3109 https://github.com/fmtlib/fmt/issues/1594, | |
| 3110 https://github.com/fmtlib/fmt/pull/1596, | |
| 3111 https://github.com/fmtlib/fmt/issues/1604, | |
| 3112 https://github.com/fmtlib/fmt/pull/1606, | |
| 3113 https://github.com/fmtlib/fmt/issues/1607, | |
| 3114 https://github.com/fmtlib/fmt/issues/1609). | |
| 3115 Thanks @marti4d, @iPherian, @parkertomatoes, @gsjaardema, @chronoxor, | |
| 3116 @DanielaE, @torsten48, @tohammer, @lefticus, @ryusakki, @adnsv, @fghzxm, | |
| 3117 @refnum, @pramodk, @Spirrwell and @scramsby. | |
| 3118 | |
| 3119 # 6.1.2 - 2019-12-11 | |
| 3120 | |
| 3121 - Fixed ABI compatibility with `libfmt.so.6.0.0` | |
| 3122 (https://github.com/fmtlib/fmt/issues/1471). | |
| 3123 - Fixed handling types convertible to `std::string_view` | |
| 3124 (https://github.com/fmtlib/fmt/pull/1451). Thanks @denizevrenci. | |
| 3125 - Made CUDA test an opt-in enabled via the `FMT_CUDA_TEST` CMake | |
| 3126 option. | |
| 3127 - Fixed sign conversion warnings | |
| 3128 (https://github.com/fmtlib/fmt/pull/1440). Thanks @0x8000-0000. | |
| 3129 | |
| 3130 # 6.1.1 - 2019-12-04 | |
| 3131 | |
| 3132 - Fixed shared library build on Windows | |
| 3133 (https://github.com/fmtlib/fmt/pull/1443, | |
| 3134 https://github.com/fmtlib/fmt/issues/1445, | |
| 3135 https://github.com/fmtlib/fmt/pull/1446, | |
| 3136 https://github.com/fmtlib/fmt/issues/1450). | |
| 3137 Thanks @egorpugin and @bbolli. | |
| 3138 - Added a missing decimal point in exponent notation with trailing | |
| 3139 zeros. | |
| 3140 - Removed deprecated `format_arg_store::TYPES`. | |
| 3141 | |
| 3142 # 6.1.0 - 2019-12-01 | |
| 3143 | |
| 3144 - {fmt} now formats IEEE 754 `float` and `double` using the shortest | |
| 3145 decimal representation with correct rounding by default: | |
| 3146 | |
| 3147 ```c++ | |
| 3148 #include <cmath> | |
| 3149 #include <fmt/core.h> | |
| 3150 | |
| 3151 int main() { | |
| 3152 fmt::print("{}", M_PI); | |
| 3153 } | |
| 3154 ``` | |
| 3155 | |
| 3156 prints `3.141592653589793`. | |
| 3157 | |
| 3158 - Made the fast binary to decimal floating-point formatter the | |
| 3159 default, simplified it and improved performance. {fmt} is now 15 | |
| 3160 times faster than libc++\'s `std::ostringstream`, 11 times faster | |
| 3161 than `printf` and 10% faster than double-conversion on | |
| 3162 [dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark): | |
| 3163 | |
| 3164 | Function | Time (ns) | Speedup | | |
| 3165 | ------------- | --------: | ------: | | |
| 3166 | ostringstream | 1,346.30 | 1.00x | | |
| 3167 | ostrstream | 1,195.74 | 1.13x | | |
| 3168 | sprintf | 995.08 | 1.35x | | |
| 3169 | doubleconv | 99.10 | 13.59x | | |
| 3170 | fmt | 88.34 | 15.24x | | |
| 3171 | |
| 3172  | |
| 3173 | |
| 3174 - {fmt} no longer converts `float` arguments to `double`. In | |
| 3175 particular this improves the default (shortest) representation of | |
| 3176 floats and makes `fmt::format` consistent with `std::format` specs | |
| 3177 (https://github.com/fmtlib/fmt/issues/1336, | |
| 3178 https://github.com/fmtlib/fmt/issues/1353, | |
| 3179 https://github.com/fmtlib/fmt/pull/1360, | |
| 3180 https://github.com/fmtlib/fmt/pull/1361): | |
| 3181 | |
| 3182 ```c++ | |
| 3183 fmt::print("{}", 0.1f); | |
| 3184 ``` | |
| 3185 | |
| 3186 prints `0.1` instead of `0.10000000149011612`. | |
| 3187 | |
| 3188 Thanks @orivej. | |
| 3189 | |
| 3190 - Made floating-point formatting output consistent with | |
| 3191 `printf`/iostreams | |
| 3192 (https://github.com/fmtlib/fmt/issues/1376, | |
| 3193 https://github.com/fmtlib/fmt/issues/1417). | |
| 3194 | |
| 3195 - Added support for 128-bit integers | |
| 3196 (https://github.com/fmtlib/fmt/pull/1287): | |
| 3197 | |
| 3198 ```c++ | |
| 3199 fmt::print("{}", std::numeric_limits<__int128_t>::max()); | |
| 3200 ``` | |
| 3201 | |
| 3202 prints `170141183460469231731687303715884105727`. | |
| 3203 | |
| 3204 Thanks @denizevrenci. | |
| 3205 | |
| 3206 - The overload of `print` that takes `text_style` is now atomic, i.e. | |
| 3207 the output from different threads doesn\'t interleave | |
| 3208 (https://github.com/fmtlib/fmt/pull/1351). Thanks @tankiJong. | |
| 3209 | |
| 3210 - Made compile time in the header-only mode \~20% faster by reducing | |
| 3211 the number of template instantiations. `wchar_t` overload of | |
| 3212 `vprint` was moved from `fmt/core.h` to `fmt/format.h`. | |
| 3213 | |
| 3214 - Added an overload of `fmt::join` that works with tuples | |
| 3215 (https://github.com/fmtlib/fmt/issues/1322, | |
| 3216 https://github.com/fmtlib/fmt/pull/1330): | |
| 3217 | |
| 3218 ```c++ | |
| 3219 #include <tuple> | |
| 3220 #include <fmt/ranges.h> | |
| 3221 | |
| 3222 int main() { | |
| 3223 std::tuple<char, int, float> t{'a', 1, 2.0f}; | |
| 3224 fmt::print("{}", t); | |
| 3225 } | |
| 3226 ``` | |
| 3227 | |
| 3228 prints `('a', 1, 2.0)`. | |
| 3229 | |
| 3230 Thanks @jeremyong. | |
| 3231 | |
| 3232 - Changed formatting of octal zero with prefix from \"00\" to \"0\": | |
| 3233 | |
| 3234 ```c++ | |
| 3235 fmt::print("{:#o}", 0); | |
| 3236 ``` | |
| 3237 | |
| 3238 prints `0`. | |
| 3239 | |
| 3240 - The locale is now passed to ostream insertion (`<<`) operators | |
| 3241 (https://github.com/fmtlib/fmt/pull/1406): | |
| 3242 | |
| 3243 ```c++ | |
| 3244 #include <fmt/locale.h> | |
| 3245 #include <fmt/ostream.h> | |
| 3246 | |
| 3247 struct S { | |
| 3248 double value; | |
| 3249 }; | |
| 3250 | |
| 3251 std::ostream& operator<<(std::ostream& os, S s) { | |
| 3252 return os << s.value; | |
| 3253 } | |
| 3254 | |
| 3255 int main() { | |
| 3256 auto s = fmt::format(std::locale("fr_FR.UTF-8"), "{}", S{0.42}); | |
| 3257 // s == "0,42" | |
| 3258 } | |
| 3259 ``` | |
| 3260 | |
| 3261 Thanks @dlaugt. | |
| 3262 | |
| 3263 - Locale-specific number formatting now uses grouping | |
| 3264 (https://github.com/fmtlib/fmt/issues/1393, | |
| 3265 https://github.com/fmtlib/fmt/pull/1394). Thanks @skrdaniel. | |
| 3266 | |
| 3267 - Fixed handling of types with deleted implicit rvalue conversion to | |
| 3268 `const char**` (https://github.com/fmtlib/fmt/issues/1421): | |
| 3269 | |
| 3270 ```c++ | |
| 3271 struct mystring { | |
| 3272 operator const char*() const&; | |
| 3273 operator const char*() &; | |
| 3274 operator const char*() const&& = delete; | |
| 3275 operator const char*() && = delete; | |
| 3276 }; | |
| 3277 mystring str; | |
| 3278 fmt::print("{}", str); // now compiles | |
| 3279 ``` | |
| 3280 | |
| 3281 - Enums are now mapped to correct underlying types instead of `int` | |
| 3282 (https://github.com/fmtlib/fmt/pull/1286). Thanks @agmt. | |
| 3283 | |
| 3284 - Enum classes are no longer implicitly converted to `int` | |
| 3285 (https://github.com/fmtlib/fmt/issues/1424). | |
| 3286 | |
| 3287 - Added `basic_format_parse_context` for consistency with C++20 | |
| 3288 `std::format` and deprecated `basic_parse_context`. | |
| 3289 | |
| 3290 - Fixed handling of UTF-8 in precision | |
| 3291 (https://github.com/fmtlib/fmt/issues/1389, | |
| 3292 https://github.com/fmtlib/fmt/pull/1390). Thanks @tajtiattila. | |
| 3293 | |
| 3294 - {fmt} can now be installed on Linux, macOS and Windows with | |
| 3295 [Conda](https://docs.conda.io/en/latest/) using its | |
| 3296 [conda-forge](https://conda-forge.org) | |
| 3297 [package](https://github.com/conda-forge/fmt-feedstock) | |
| 3298 (https://github.com/fmtlib/fmt/pull/1410): | |
| 3299 | |
| 3300 conda install -c conda-forge fmt | |
| 3301 | |
| 3302 Thanks @tdegeus. | |
| 3303 | |
| 3304 - Added a CUDA test (https://github.com/fmtlib/fmt/pull/1285, | |
| 3305 https://github.com/fmtlib/fmt/pull/1317). | |
| 3306 Thanks @luncliff and @risa2000. | |
| 3307 | |
| 3308 - Improved documentation | |
| 3309 (https://github.com/fmtlib/fmt/pull/1276, | |
| 3310 https://github.com/fmtlib/fmt/issues/1291, | |
| 3311 https://github.com/fmtlib/fmt/issues/1296, | |
| 3312 https://github.com/fmtlib/fmt/pull/1315, | |
| 3313 https://github.com/fmtlib/fmt/pull/1332, | |
| 3314 https://github.com/fmtlib/fmt/pull/1337, | |
| 3315 https://github.com/fmtlib/fmt/issues/1395 | |
| 3316 https://github.com/fmtlib/fmt/pull/1418). | |
| 3317 Thanks @waywardmonkeys, @pauldreik and @jackoalan. | |
| 3318 | |
| 3319 - Various code improvements | |
| 3320 (https://github.com/fmtlib/fmt/pull/1358, | |
| 3321 https://github.com/fmtlib/fmt/pull/1407). | |
| 3322 Thanks @orivej and @dpacbach. | |
| 3323 | |
| 3324 - Fixed compile-time format string checks for user-defined types | |
| 3325 (https://github.com/fmtlib/fmt/issues/1292). | |
| 3326 | |
| 3327 - Worked around a false positive in `unsigned-integer-overflow` sanitizer | |
| 3328 (https://github.com/fmtlib/fmt/issues/1377). | |
| 3329 | |
| 3330 - Fixed various warnings and compilation issues | |
| 3331 (https://github.com/fmtlib/fmt/issues/1273, | |
| 3332 https://github.com/fmtlib/fmt/pull/1278, | |
| 3333 https://github.com/fmtlib/fmt/pull/1280, | |
| 3334 https://github.com/fmtlib/fmt/issues/1281, | |
| 3335 https://github.com/fmtlib/fmt/issues/1288, | |
| 3336 https://github.com/fmtlib/fmt/pull/1290, | |
| 3337 https://github.com/fmtlib/fmt/pull/1301, | |
| 3338 https://github.com/fmtlib/fmt/issues/1305, | |
| 3339 https://github.com/fmtlib/fmt/issues/1306, | |
| 3340 https://github.com/fmtlib/fmt/issues/1309, | |
| 3341 https://github.com/fmtlib/fmt/pull/1312, | |
| 3342 https://github.com/fmtlib/fmt/issues/1313, | |
| 3343 https://github.com/fmtlib/fmt/issues/1316, | |
| 3344 https://github.com/fmtlib/fmt/issues/1319, | |
| 3345 https://github.com/fmtlib/fmt/pull/1320, | |
| 3346 https://github.com/fmtlib/fmt/pull/1326, | |
| 3347 https://github.com/fmtlib/fmt/pull/1328, | |
| 3348 https://github.com/fmtlib/fmt/issues/1344, | |
| 3349 https://github.com/fmtlib/fmt/pull/1345, | |
| 3350 https://github.com/fmtlib/fmt/pull/1347, | |
| 3351 https://github.com/fmtlib/fmt/pull/1349, | |
| 3352 https://github.com/fmtlib/fmt/issues/1354, | |
| 3353 https://github.com/fmtlib/fmt/issues/1362, | |
| 3354 https://github.com/fmtlib/fmt/issues/1366, | |
| 3355 https://github.com/fmtlib/fmt/pull/1364, | |
| 3356 https://github.com/fmtlib/fmt/pull/1370, | |
| 3357 https://github.com/fmtlib/fmt/pull/1371, | |
| 3358 https://github.com/fmtlib/fmt/issues/1385, | |
| 3359 https://github.com/fmtlib/fmt/issues/1388, | |
| 3360 https://github.com/fmtlib/fmt/pull/1397, | |
| 3361 https://github.com/fmtlib/fmt/pull/1414, | |
| 3362 https://github.com/fmtlib/fmt/pull/1416, | |
| 3363 https://github.com/fmtlib/fmt/issues/1422 | |
| 3364 https://github.com/fmtlib/fmt/pull/1427, | |
| 3365 https://github.com/fmtlib/fmt/issues/1431, | |
| 3366 https://github.com/fmtlib/fmt/pull/1433). | |
| 3367 Thanks @hhb, @gsjaardema, @gabime, @neheb, @vedranmiletic, @dkavolis, | |
| 3368 @mwinterb, @orivej, @denizevrenci, @leonklingele, @chronoxor, @kent-tri, | |
| 3369 @0x8000-0000 and @marti4d. | |
| 3370 | |
| 3371 # 6.0.0 - 2019-08-26 | |
| 3372 | |
| 3373 - Switched to the [MIT license]( | |
| 3374 https://github.com/fmtlib/fmt/blob/5a4b24613ba16cc689977c3b5bd8274a3ba1dd1f/LICENSE.rst) | |
| 3375 with an optional exception that allows distributing binary code | |
| 3376 without attribution. | |
| 3377 | |
| 3378 - Floating-point formatting is now locale-independent by default: | |
| 3379 | |
| 3380 ```c++ | |
| 3381 #include <locale> | |
| 3382 #include <fmt/core.h> | |
| 3383 | |
| 3384 int main() { | |
| 3385 std::locale::global(std::locale("ru_RU.UTF-8")); | |
| 3386 fmt::print("value = {}", 4.2); | |
| 3387 } | |
| 3388 ``` | |
| 3389 | |
| 3390 prints \"value = 4.2\" regardless of the locale. | |
| 3391 | |
| 3392 For locale-specific formatting use the `n` specifier: | |
| 3393 | |
| 3394 ```c++ | |
| 3395 std::locale::global(std::locale("ru_RU.UTF-8")); | |
| 3396 fmt::print("value = {:n}", 4.2); | |
| 3397 ``` | |
| 3398 | |
| 3399 prints \"value = 4,2\". | |
| 3400 | |
| 3401 - Added an experimental Grisu floating-point formatting algorithm | |
| 3402 implementation (disabled by default). To enable it compile with the | |
| 3403 `FMT_USE_GRISU` macro defined to 1: | |
| 3404 | |
| 3405 ```c++ | |
| 3406 #define FMT_USE_GRISU 1 | |
| 3407 #include <fmt/format.h> | |
| 3408 | |
| 3409 auto s = fmt::format("{}", 4.2); // formats 4.2 using Grisu | |
| 3410 ``` | |
| 3411 | |
| 3412 With Grisu enabled, {fmt} is 13x faster than `std::ostringstream` | |
| 3413 (libc++) and 10x faster than `sprintf` on | |
| 3414 [dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark) ([full | |
| 3415 results](https://fmt.dev/unknown_mac64_clang10.0.html)): | |
| 3416 | |
| 3417  | |
| 3418 | |
| 3419 - Separated formatting and parsing contexts for consistency with | |
| 3420 [C++20 std::format](http://eel.is/c++draft/format), removing the | |
| 3421 undocumented `basic_format_context::parse_context()` function. | |
| 3422 | |
| 3423 - Added [oss-fuzz](https://github.com/google/oss-fuzz) support | |
| 3424 (https://github.com/fmtlib/fmt/pull/1199). Thanks @pauldreik. | |
| 3425 | |
| 3426 - `formatter` specializations now always take precedence over | |
| 3427 `operator<<` (https://github.com/fmtlib/fmt/issues/952): | |
| 3428 | |
| 3429 ```c++ | |
| 3430 #include <iostream> | |
| 3431 #include <fmt/ostream.h> | |
| 3432 | |
| 3433 struct S {}; | |
| 3434 | |
| 3435 std::ostream& operator<<(std::ostream& os, S) { | |
| 3436 return os << 1; | |
| 3437 } | |
| 3438 | |
| 3439 template <> | |
| 3440 struct fmt::formatter<S> : fmt::formatter<int> { | |
| 3441 auto format(S, format_context& ctx) { | |
| 3442 return formatter<int>::format(2, ctx); | |
| 3443 } | |
| 3444 }; | |
| 3445 | |
| 3446 int main() { | |
| 3447 std::cout << S() << "\n"; // prints 1 using operator<< | |
| 3448 fmt::print("{}\n", S()); // prints 2 using formatter | |
| 3449 } | |
| 3450 ``` | |
| 3451 | |
| 3452 - Introduced the experimental `fmt::compile` function that does format | |
| 3453 string compilation | |
| 3454 (https://github.com/fmtlib/fmt/issues/618, | |
| 3455 https://github.com/fmtlib/fmt/issues/1169, | |
| 3456 https://github.com/fmtlib/fmt/pull/1171): | |
| 3457 | |
| 3458 ```c++ | |
| 3459 #include <fmt/compile.h> | |
| 3460 | |
| 3461 auto f = fmt::compile<int>("{}"); | |
| 3462 std::string s = fmt::format(f, 42); // can be called multiple times to | |
| 3463 // format different values | |
| 3464 // s == "42" | |
| 3465 ``` | |
| 3466 | |
| 3467 It moves the cost of parsing a format string outside of the format | |
| 3468 function which can be beneficial when identically formatting many | |
| 3469 objects of the same types. Thanks @stryku. | |
| 3470 | |
| 3471 - Added experimental `%` format specifier that formats floating-point | |
| 3472 values as percentages | |
| 3473 (https://github.com/fmtlib/fmt/pull/1060, | |
| 3474 https://github.com/fmtlib/fmt/pull/1069, | |
| 3475 https://github.com/fmtlib/fmt/pull/1071): | |
| 3476 | |
| 3477 ```c++ | |
| 3478 auto s = fmt::format("{:.1%}", 0.42); // s == "42.0%" | |
| 3479 ``` | |
| 3480 | |
| 3481 Thanks @gawain-bolton. | |
| 3482 | |
| 3483 - Implemented precision for floating-point durations | |
| 3484 (https://github.com/fmtlib/fmt/issues/1004, | |
| 3485 https://github.com/fmtlib/fmt/pull/1012): | |
| 3486 | |
| 3487 ```c++ | |
| 3488 auto s = fmt::format("{:.1}", std::chrono::duration<double>(1.234)); | |
| 3489 // s == 1.2s | |
| 3490 ``` | |
| 3491 | |
| 3492 Thanks @DanielaE. | |
| 3493 | |
| 3494 - Implemented `chrono` format specifiers `%Q` and `%q` that give the | |
| 3495 value and the unit respectively | |
| 3496 (https://github.com/fmtlib/fmt/pull/1019): | |
| 3497 | |
| 3498 ```c++ | |
| 3499 auto value = fmt::format("{:%Q}", 42s); // value == "42" | |
| 3500 auto unit = fmt::format("{:%q}", 42s); // unit == "s" | |
| 3501 ``` | |
| 3502 | |
| 3503 Thanks @DanielaE. | |
| 3504 | |
| 3505 - Fixed handling of dynamic width in chrono formatter: | |
| 3506 | |
| 3507 ```c++ | |
| 3508 auto s = fmt::format("{0:{1}%H:%M:%S}", std::chrono::seconds(12345), 12); | |
| 3509 // ^ width argument index ^ width | |
| 3510 // s == "03:25:45 " | |
| 3511 ``` | |
| 3512 | |
| 3513 Thanks Howard Hinnant. | |
| 3514 | |
| 3515 - Removed deprecated `fmt/time.h`. Use `fmt/chrono.h` instead. | |
| 3516 | |
| 3517 - Added `fmt::format` and `fmt::vformat` overloads that take | |
| 3518 `text_style` (https://github.com/fmtlib/fmt/issues/993, | |
| 3519 https://github.com/fmtlib/fmt/pull/994): | |
| 3520 | |
| 3521 ```c++ | |
| 3522 #include <fmt/color.h> | |
| 3523 | |
| 3524 std::string message = fmt::format(fmt::emphasis::bold | fg(fmt::color::red), | |
| 3525 "The answer is {}.", 42); | |
| 3526 ``` | |
| 3527 | |
| 3528 Thanks @Naios. | |
| 3529 | |
| 3530 - Removed the deprecated color API (`print_colored`). Use the new API, | |
| 3531 namely `print` overloads that take `text_style` instead. | |
| 3532 | |
| 3533 - Made `std::unique_ptr` and `std::shared_ptr` formattable as pointers | |
| 3534 via `fmt::ptr` (https://github.com/fmtlib/fmt/pull/1121): | |
| 3535 | |
| 3536 ```c++ | |
| 3537 std::unique_ptr<int> p = ...; | |
| 3538 fmt::print("{}", fmt::ptr(p)); // prints p as a pointer | |
| 3539 ``` | |
| 3540 | |
| 3541 Thanks @sighingnow. | |
| 3542 | |
| 3543 - Made `print` and `vprint` report I/O errors | |
| 3544 (https://github.com/fmtlib/fmt/issues/1098, | |
| 3545 https://github.com/fmtlib/fmt/pull/1099). Thanks @BillyDonahue. | |
| 3546 | |
| 3547 - Marked deprecated APIs with the `[[deprecated]]` attribute and | |
| 3548 removed internal uses of deprecated APIs | |
| 3549 (https://github.com/fmtlib/fmt/pull/1022). Thanks @eliaskosunen. | |
| 3550 | |
| 3551 - Modernized the codebase using more C++11 features and removing | |
| 3552 workarounds. Most importantly, `buffer_context` is now an alias | |
| 3553 template, so use `buffer_context<T>` instead of | |
| 3554 `buffer_context<T>::type`. These features require GCC 4.8 or later. | |
| 3555 | |
| 3556 - `formatter` specializations now always take precedence over implicit | |
| 3557 conversions to `int` and the undocumented `convert_to_int` trait is | |
| 3558 now deprecated. | |
| 3559 | |
| 3560 - Moved the undocumented `basic_writer`, `writer`, and `wwriter` types | |
| 3561 to the `internal` namespace. | |
| 3562 | |
| 3563 - Removed deprecated `basic_format_context::begin()`. Use `out()` | |
| 3564 instead. | |
| 3565 | |
| 3566 - Disallowed passing the result of `join` as an lvalue to prevent | |
| 3567 misuse. | |
| 3568 | |
| 3569 - Refactored the undocumented structs that represent parsed format | |
| 3570 specifiers to simplify the API and allow multibyte fill. | |
| 3571 | |
| 3572 - Moved SFINAE to template parameters to reduce symbol sizes. | |
| 3573 | |
| 3574 - Switched to `fputws` for writing wide strings so that it\'s no | |
| 3575 longer required to call `_setmode` on Windows | |
| 3576 (https://github.com/fmtlib/fmt/issues/1229, | |
| 3577 https://github.com/fmtlib/fmt/pull/1243). Thanks @jackoalan. | |
| 3578 | |
| 3579 - Improved literal-based API | |
| 3580 (https://github.com/fmtlib/fmt/pull/1254). Thanks @sylveon. | |
| 3581 | |
| 3582 - Added support for exotic platforms without `uintptr_t` such as IBM i | |
| 3583 (AS/400) which has 128-bit pointers and only 64-bit integers | |
| 3584 (https://github.com/fmtlib/fmt/issues/1059). | |
| 3585 | |
| 3586 - Added [Sublime Text syntax highlighting config]( | |
| 3587 https://github.com/fmtlib/fmt/blob/master/support/C%2B%2B.sublime-syntax) | |
| 3588 (https://github.com/fmtlib/fmt/issues/1037). Thanks @Kronuz. | |
| 3589 | |
| 3590 - Added the `FMT_ENFORCE_COMPILE_STRING` macro to enforce the use of | |
| 3591 compile-time format strings | |
| 3592 (https://github.com/fmtlib/fmt/pull/1231). Thanks @jackoalan. | |
| 3593 | |
| 3594 - Stopped setting `CMAKE_BUILD_TYPE` if {fmt} is a subproject | |
| 3595 (https://github.com/fmtlib/fmt/issues/1081). | |
| 3596 | |
| 3597 - Various build improvements | |
| 3598 (https://github.com/fmtlib/fmt/pull/1039, | |
| 3599 https://github.com/fmtlib/fmt/pull/1078, | |
| 3600 https://github.com/fmtlib/fmt/pull/1091, | |
| 3601 https://github.com/fmtlib/fmt/pull/1103, | |
| 3602 https://github.com/fmtlib/fmt/pull/1177). | |
| 3603 Thanks @luncliff, @jasonszang, @olafhering, @Lecetem and @pauldreik. | |
| 3604 | |
| 3605 - Improved documentation | |
| 3606 (https://github.com/fmtlib/fmt/issues/1049, | |
| 3607 https://github.com/fmtlib/fmt/pull/1051, | |
| 3608 https://github.com/fmtlib/fmt/pull/1083, | |
| 3609 https://github.com/fmtlib/fmt/pull/1113, | |
| 3610 https://github.com/fmtlib/fmt/pull/1114, | |
| 3611 https://github.com/fmtlib/fmt/issues/1146, | |
| 3612 https://github.com/fmtlib/fmt/issues/1180, | |
| 3613 https://github.com/fmtlib/fmt/pull/1250, | |
| 3614 https://github.com/fmtlib/fmt/pull/1252, | |
| 3615 https://github.com/fmtlib/fmt/pull/1265). | |
| 3616 Thanks @mikelui, @foonathan, @BillyDonahue, @jwakely, @kaisbe and | |
| 3617 @sdebionne. | |
| 3618 | |
| 3619 - Fixed ambiguous formatter specialization in `fmt/ranges.h` | |
| 3620 (https://github.com/fmtlib/fmt/issues/1123). | |
| 3621 | |
| 3622 - Fixed formatting of a non-empty `std::filesystem::path` which is an | |
| 3623 infinitely deep range of its components | |
| 3624 (https://github.com/fmtlib/fmt/issues/1268). | |
| 3625 | |
| 3626 - Fixed handling of general output iterators when formatting | |
| 3627 characters (https://github.com/fmtlib/fmt/issues/1056, | |
| 3628 https://github.com/fmtlib/fmt/pull/1058). Thanks @abolz. | |
| 3629 | |
| 3630 - Fixed handling of output iterators in `formatter` specialization for | |
| 3631 ranges (https://github.com/fmtlib/fmt/issues/1064). | |
| 3632 | |
| 3633 - Fixed handling of exotic character types | |
| 3634 (https://github.com/fmtlib/fmt/issues/1188). | |
| 3635 | |
| 3636 - Made chrono formatting work with exceptions disabled | |
| 3637 (https://github.com/fmtlib/fmt/issues/1062). | |
| 3638 | |
| 3639 - Fixed DLL visibility issues | |
| 3640 (https://github.com/fmtlib/fmt/pull/1134, | |
| 3641 https://github.com/fmtlib/fmt/pull/1147). Thanks @denchat. | |
| 3642 | |
| 3643 - Disabled the use of UDL template extension on GCC 9 | |
| 3644 (https://github.com/fmtlib/fmt/issues/1148). | |
| 3645 | |
| 3646 - Removed misplaced `format` compile-time checks from `printf` | |
| 3647 (https://github.com/fmtlib/fmt/issues/1173). | |
| 3648 | |
| 3649 - Fixed issues in the experimental floating-point formatter | |
| 3650 (https://github.com/fmtlib/fmt/issues/1072, | |
| 3651 https://github.com/fmtlib/fmt/issues/1129, | |
| 3652 https://github.com/fmtlib/fmt/issues/1153, | |
| 3653 https://github.com/fmtlib/fmt/pull/1155, | |
| 3654 https://github.com/fmtlib/fmt/issues/1210, | |
| 3655 https://github.com/fmtlib/fmt/issues/1222). Thanks @alabuzhev. | |
| 3656 | |
| 3657 - Fixed bugs discovered by fuzzing or during fuzzing integration | |
| 3658 (https://github.com/fmtlib/fmt/issues/1124, | |
| 3659 https://github.com/fmtlib/fmt/issues/1127, | |
| 3660 https://github.com/fmtlib/fmt/issues/1132, | |
| 3661 https://github.com/fmtlib/fmt/pull/1135, | |
| 3662 https://github.com/fmtlib/fmt/issues/1136, | |
| 3663 https://github.com/fmtlib/fmt/issues/1141, | |
| 3664 https://github.com/fmtlib/fmt/issues/1142, | |
| 3665 https://github.com/fmtlib/fmt/issues/1178, | |
| 3666 https://github.com/fmtlib/fmt/issues/1179, | |
| 3667 https://github.com/fmtlib/fmt/issues/1194). Thanks @pauldreik. | |
| 3668 | |
| 3669 - Fixed building tests on FreeBSD and Hurd | |
| 3670 (https://github.com/fmtlib/fmt/issues/1043). Thanks @jackyf. | |
| 3671 | |
| 3672 - Fixed various warnings and compilation issues | |
| 3673 (https://github.com/fmtlib/fmt/pull/998, | |
| 3674 https://github.com/fmtlib/fmt/pull/1006, | |
| 3675 https://github.com/fmtlib/fmt/issues/1008, | |
| 3676 https://github.com/fmtlib/fmt/issues/1011, | |
| 3677 https://github.com/fmtlib/fmt/issues/1025, | |
| 3678 https://github.com/fmtlib/fmt/pull/1027, | |
| 3679 https://github.com/fmtlib/fmt/pull/1028, | |
| 3680 https://github.com/fmtlib/fmt/pull/1029, | |
| 3681 https://github.com/fmtlib/fmt/pull/1030, | |
| 3682 https://github.com/fmtlib/fmt/pull/1031, | |
| 3683 https://github.com/fmtlib/fmt/pull/1054, | |
| 3684 https://github.com/fmtlib/fmt/issues/1063, | |
| 3685 https://github.com/fmtlib/fmt/pull/1068, | |
| 3686 https://github.com/fmtlib/fmt/pull/1074, | |
| 3687 https://github.com/fmtlib/fmt/pull/1075, | |
| 3688 https://github.com/fmtlib/fmt/pull/1079, | |
| 3689 https://github.com/fmtlib/fmt/pull/1086, | |
| 3690 https://github.com/fmtlib/fmt/issues/1088, | |
| 3691 https://github.com/fmtlib/fmt/pull/1089, | |
| 3692 https://github.com/fmtlib/fmt/pull/1094, | |
| 3693 https://github.com/fmtlib/fmt/issues/1101, | |
| 3694 https://github.com/fmtlib/fmt/pull/1102, | |
| 3695 https://github.com/fmtlib/fmt/issues/1105, | |
| 3696 https://github.com/fmtlib/fmt/pull/1107, | |
| 3697 https://github.com/fmtlib/fmt/issues/1115, | |
| 3698 https://github.com/fmtlib/fmt/issues/1117, | |
| 3699 https://github.com/fmtlib/fmt/issues/1118, | |
| 3700 https://github.com/fmtlib/fmt/issues/1120, | |
| 3701 https://github.com/fmtlib/fmt/issues/1123, | |
| 3702 https://github.com/fmtlib/fmt/pull/1139, | |
| 3703 https://github.com/fmtlib/fmt/issues/1140, | |
| 3704 https://github.com/fmtlib/fmt/issues/1143, | |
| 3705 https://github.com/fmtlib/fmt/pull/1144, | |
| 3706 https://github.com/fmtlib/fmt/pull/1150, | |
| 3707 https://github.com/fmtlib/fmt/pull/1151, | |
| 3708 https://github.com/fmtlib/fmt/issues/1152, | |
| 3709 https://github.com/fmtlib/fmt/issues/1154, | |
| 3710 https://github.com/fmtlib/fmt/issues/1156, | |
| 3711 https://github.com/fmtlib/fmt/pull/1159, | |
| 3712 https://github.com/fmtlib/fmt/issues/1175, | |
| 3713 https://github.com/fmtlib/fmt/issues/1181, | |
| 3714 https://github.com/fmtlib/fmt/issues/1186, | |
| 3715 https://github.com/fmtlib/fmt/pull/1187, | |
| 3716 https://github.com/fmtlib/fmt/pull/1191, | |
| 3717 https://github.com/fmtlib/fmt/issues/1197, | |
| 3718 https://github.com/fmtlib/fmt/issues/1200, | |
| 3719 https://github.com/fmtlib/fmt/issues/1203, | |
| 3720 https://github.com/fmtlib/fmt/issues/1205, | |
| 3721 https://github.com/fmtlib/fmt/pull/1206, | |
| 3722 https://github.com/fmtlib/fmt/issues/1213, | |
| 3723 https://github.com/fmtlib/fmt/issues/1214, | |
| 3724 https://github.com/fmtlib/fmt/pull/1217, | |
| 3725 https://github.com/fmtlib/fmt/issues/1228, | |
| 3726 https://github.com/fmtlib/fmt/pull/1230, | |
| 3727 https://github.com/fmtlib/fmt/issues/1232, | |
| 3728 https://github.com/fmtlib/fmt/pull/1235, | |
| 3729 https://github.com/fmtlib/fmt/pull/1236, | |
| 3730 https://github.com/fmtlib/fmt/issues/1240). | |
| 3731 Thanks @DanielaE, @mwinterb, @eliaskosunen, @morinmorin, @ricco19, | |
| 3732 @waywardmonkeys, @chronoxor, @remyabel, @pauldreik, @gsjaardema, @rcane, | |
| 3733 @mocabe, @denchat, @cjdb, @HazardyKnusperkeks, @vedranmiletic, @jackoalan, | |
| 3734 @DaanDeMeyer and @starkmapper. | |
| 3735 | |
| 3736 # 5.3.0 - 2018-12-28 | |
| 3737 | |
| 3738 - Introduced experimental chrono formatting support: | |
| 3739 | |
| 3740 ```c++ | |
| 3741 #include <fmt/chrono.h> | |
| 3742 | |
| 3743 int main() { | |
| 3744 using namespace std::literals::chrono_literals; | |
| 3745 fmt::print("Default format: {} {}\n", 42s, 100ms); | |
| 3746 fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s); | |
| 3747 } | |
| 3748 ``` | |
| 3749 | |
| 3750 prints: | |
| 3751 | |
| 3752 Default format: 42s 100ms | |
| 3753 strftime-like format: 03:15:30 | |
| 3754 | |
| 3755 - Added experimental support for emphasis (bold, italic, underline, | |
| 3756 strikethrough), colored output to a file stream, and improved | |
| 3757 colored formatting API | |
| 3758 (https://github.com/fmtlib/fmt/pull/961, | |
| 3759 https://github.com/fmtlib/fmt/pull/967, | |
| 3760 https://github.com/fmtlib/fmt/pull/973): | |
| 3761 | |
| 3762 ```c++ | |
| 3763 #include <fmt/color.h> | |
| 3764 | |
| 3765 int main() { | |
| 3766 print(fg(fmt::color::crimson) | fmt::emphasis::bold, | |
| 3767 "Hello, {}!\n", "world"); | |
| 3768 print(fg(fmt::color::floral_white) | bg(fmt::color::slate_gray) | | |
| 3769 fmt::emphasis::underline, "Hello, {}!\n", "мир"); | |
| 3770 print(fg(fmt::color::steel_blue) | fmt::emphasis::italic, | |
| 3771 "Hello, {}!\n", "世界"); | |
| 3772 } | |
| 3773 ``` | |
| 3774 | |
| 3775 prints the following on modern terminals with RGB color support: | |
| 3776 | |
| 3777  | |
| 3778 | |
| 3779 Thanks @Rakete1111. | |
| 3780 | |
| 3781 - Added support for 4-bit terminal colors | |
| 3782 (https://github.com/fmtlib/fmt/issues/968, | |
| 3783 https://github.com/fmtlib/fmt/pull/974) | |
| 3784 | |
| 3785 ```c++ | |
| 3786 #include <fmt/color.h> | |
| 3787 | |
| 3788 int main() { | |
| 3789 print(fg(fmt::terminal_color::red), "stop\n"); | |
| 3790 } | |
| 3791 ``` | |
| 3792 | |
| 3793 Note that these colors vary by terminal: | |
| 3794 | |
| 3795  | |
| 3796 | |
| 3797 Thanks @Rakete1111. | |
| 3798 | |
| 3799 - Parameterized formatting functions on the type of the format string | |
| 3800 (https://github.com/fmtlib/fmt/issues/880, | |
| 3801 https://github.com/fmtlib/fmt/pull/881, | |
| 3802 https://github.com/fmtlib/fmt/pull/883, | |
| 3803 https://github.com/fmtlib/fmt/pull/885, | |
| 3804 https://github.com/fmtlib/fmt/pull/897, | |
| 3805 https://github.com/fmtlib/fmt/issues/920). Any object of | |
| 3806 type `S` that has an overloaded `to_string_view(const S&)` returning | |
| 3807 `fmt::string_view` can be used as a format string: | |
| 3808 | |
| 3809 ```c++ | |
| 3810 namespace my_ns { | |
| 3811 inline string_view to_string_view(const my_string& s) { | |
| 3812 return {s.data(), s.length()}; | |
| 3813 } | |
| 3814 } | |
| 3815 | |
| 3816 std::string message = fmt::format(my_string("The answer is {}."), 42); | |
| 3817 ``` | |
| 3818 | |
| 3819 Thanks @DanielaE. | |
| 3820 | |
| 3821 - Made `std::string_view` work as a format string | |
| 3822 (https://github.com/fmtlib/fmt/pull/898): | |
| 3823 | |
| 3824 ```c++ | |
| 3825 auto message = fmt::format(std::string_view("The answer is {}."), 42); | |
| 3826 ``` | |
| 3827 | |
| 3828 Thanks @DanielaE. | |
| 3829 | |
| 3830 - Added wide string support to compile-time format string checks | |
| 3831 (https://github.com/fmtlib/fmt/pull/924): | |
| 3832 | |
| 3833 ```c++ | |
| 3834 print(fmt(L"{:f}"), 42); // compile-time error: invalid type specifier | |
| 3835 ``` | |
| 3836 | |
| 3837 Thanks @XZiar. | |
| 3838 | |
| 3839 - Made colored print functions work with wide strings | |
| 3840 (https://github.com/fmtlib/fmt/pull/867): | |
| 3841 | |
| 3842 ```c++ | |
| 3843 #include <fmt/color.h> | |
| 3844 | |
| 3845 int main() { | |
| 3846 print(fg(fmt::color::red), L"{}\n", 42); | |
| 3847 } | |
| 3848 ``` | |
| 3849 | |
| 3850 Thanks @DanielaE. | |
| 3851 | |
| 3852 - Introduced experimental Unicode support | |
| 3853 (https://github.com/fmtlib/fmt/issues/628, | |
| 3854 https://github.com/fmtlib/fmt/pull/891): | |
| 3855 | |
| 3856 ```c++ | |
| 3857 using namespace fmt::literals; | |
| 3858 auto s = fmt::format("{:*^5}"_u, "🤡"_u); // s == "**🤡**"_u | |
| 3859 ``` | |
| 3860 | |
| 3861 - Improved locale support: | |
| 3862 | |
| 3863 ```c++ | |
| 3864 #include <fmt/locale.h> | |
| 3865 | |
| 3866 struct numpunct : std::numpunct<char> { | |
| 3867 protected: | |
| 3868 char do_thousands_sep() const override { return '~'; } | |
| 3869 }; | |
| 3870 | |
| 3871 std::locale loc; | |
| 3872 auto s = fmt::format(std::locale(loc, new numpunct()), "{:n}", 1234567); | |
| 3873 // s == "1~234~567" | |
| 3874 ``` | |
| 3875 | |
| 3876 - Constrained formatting functions on proper iterator types | |
| 3877 (https://github.com/fmtlib/fmt/pull/921). Thanks @DanielaE. | |
| 3878 | |
| 3879 - Added `make_printf_args` and `make_wprintf_args` functions | |
| 3880 (https://github.com/fmtlib/fmt/pull/934). Thanks @tnovotny. | |
| 3881 | |
| 3882 - Deprecated `fmt::visit`, `parse_context`, and `wparse_context`. Use | |
| 3883 `fmt::visit_format_arg`, `format_parse_context`, and | |
| 3884 `wformat_parse_context` instead. | |
| 3885 | |
| 3886 - Removed undocumented `basic_fixed_buffer` which has been superseded | |
| 3887 by the iterator-based API | |
| 3888 (https://github.com/fmtlib/fmt/issues/873, | |
| 3889 https://github.com/fmtlib/fmt/pull/902). Thanks @superfunc. | |
| 3890 | |
| 3891 - Disallowed repeated leading zeros in an argument ID: | |
| 3892 | |
| 3893 ```c++ | |
| 3894 fmt::print("{000}", 42); // error | |
| 3895 ``` | |
| 3896 | |
| 3897 - Reintroduced support for gcc 4.4. | |
| 3898 | |
| 3899 - Fixed compilation on platforms with exotic `double` | |
| 3900 (https://github.com/fmtlib/fmt/issues/878). | |
| 3901 | |
| 3902 - Improved documentation | |
| 3903 (https://github.com/fmtlib/fmt/issues/164, | |
| 3904 https://github.com/fmtlib/fmt/issues/877, | |
| 3905 https://github.com/fmtlib/fmt/pull/901, | |
| 3906 https://github.com/fmtlib/fmt/pull/906, | |
| 3907 https://github.com/fmtlib/fmt/pull/979). | |
| 3908 Thanks @kookjr, @DarkDimius and @HecticSerenity. | |
| 3909 | |
| 3910 - Added pkgconfig support which makes it easier to consume the library | |
| 3911 from meson and other build systems | |
| 3912 (https://github.com/fmtlib/fmt/pull/916). Thanks @colemickens. | |
| 3913 | |
| 3914 - Various build improvements | |
| 3915 (https://github.com/fmtlib/fmt/pull/909, | |
| 3916 https://github.com/fmtlib/fmt/pull/926, | |
| 3917 https://github.com/fmtlib/fmt/pull/937, | |
| 3918 https://github.com/fmtlib/fmt/pull/953, | |
| 3919 https://github.com/fmtlib/fmt/pull/959). | |
| 3920 Thanks @tchaikov, @luncliff, @AndreasSchoenle, @hotwatermorning and @Zefz. | |
| 3921 | |
| 3922 - Improved `string_view` construction performance | |
| 3923 (https://github.com/fmtlib/fmt/pull/914). Thanks @gabime. | |
| 3924 | |
| 3925 - Fixed non-matching char types | |
| 3926 (https://github.com/fmtlib/fmt/pull/895). Thanks @DanielaE. | |
| 3927 | |
| 3928 - Fixed `format_to_n` with `std::back_insert_iterator` | |
| 3929 (https://github.com/fmtlib/fmt/pull/913). Thanks @DanielaE. | |
| 3930 | |
| 3931 - Fixed locale-dependent formatting | |
| 3932 (https://github.com/fmtlib/fmt/issues/905). | |
| 3933 | |
| 3934 - Fixed various compiler warnings and errors | |
| 3935 (https://github.com/fmtlib/fmt/pull/882, | |
| 3936 https://github.com/fmtlib/fmt/pull/886, | |
| 3937 https://github.com/fmtlib/fmt/pull/933, | |
| 3938 https://github.com/fmtlib/fmt/pull/941, | |
| 3939 https://github.com/fmtlib/fmt/issues/931, | |
| 3940 https://github.com/fmtlib/fmt/pull/943, | |
| 3941 https://github.com/fmtlib/fmt/pull/954, | |
| 3942 https://github.com/fmtlib/fmt/pull/956, | |
| 3943 https://github.com/fmtlib/fmt/pull/962, | |
| 3944 https://github.com/fmtlib/fmt/issues/965, | |
| 3945 https://github.com/fmtlib/fmt/issues/977, | |
| 3946 https://github.com/fmtlib/fmt/pull/983, | |
| 3947 https://github.com/fmtlib/fmt/pull/989). | |
| 3948 Thanks @Luthaf, @stevenhoving, @christinaa, @lgritz, @DanielaE, | |
| 3949 @0x8000-0000 and @liuping1997. | |
| 3950 | |
| 3951 # 5.2.1 - 2018-09-21 | |
| 3952 | |
| 3953 - Fixed `visit` lookup issues on gcc 7 & 8 | |
| 3954 (https://github.com/fmtlib/fmt/pull/870). Thanks @medithe. | |
| 3955 - Fixed linkage errors on older gcc. | |
| 3956 - Prevented `fmt/range.h` from specializing `fmt::basic_string_view` | |
| 3957 (https://github.com/fmtlib/fmt/issues/865, | |
| 3958 https://github.com/fmtlib/fmt/pull/868). Thanks @hhggit. | |
| 3959 - Improved error message when formatting unknown types | |
| 3960 (https://github.com/fmtlib/fmt/pull/872). Thanks @foonathan. | |
| 3961 - Disabled templated user-defined literals when compiled under nvcc | |
| 3962 (https://github.com/fmtlib/fmt/pull/875). Thanks @CandyGumdrop. | |
| 3963 - Fixed `format_to` formatting to `wmemory_buffer` | |
| 3964 (https://github.com/fmtlib/fmt/issues/874). | |
| 3965 | |
| 3966 # 5.2.0 - 2018-09-13 | |
| 3967 | |
| 3968 - Optimized format string parsing and argument processing which | |
| 3969 resulted in up to 5x speed up on long format strings and significant | |
| 3970 performance boost on various benchmarks. For example, version 5.2 is | |
| 3971 2.22x faster than 5.1 on decimal integer formatting with `format_to` | |
| 3972 (macOS, clang-902.0.39.2): | |
| 3973 | |
| 3974 | Method | Time, s | Speedup | | |
| 3975 | -------------------------- | --------------: | ------: | | |
| 3976 | fmt::format 5.1 | 0.58 | | | |
| 3977 | fmt::format 5.2 | 0.35 | 1.66x | | |
| 3978 | fmt::format_to 5.1 | 0.51 | | | |
| 3979 | fmt::format_to 5.2 | 0.23 | 2.22x | | |
| 3980 | sprintf | 0.71 | | | |
| 3981 | std::to_string | 1.01 | | | |
| 3982 | std::stringstream | 1.73 | | | |
| 3983 | |
| 3984 - Changed the `fmt` macro from opt-out to opt-in to prevent name | |
| 3985 collisions. To enable it define the `FMT_STRING_ALIAS` macro to 1 | |
| 3986 before including `fmt/format.h`: | |
| 3987 | |
| 3988 ```c++ | |
| 3989 #define FMT_STRING_ALIAS 1 | |
| 3990 #include <fmt/format.h> | |
| 3991 std::string answer = format(fmt("{}"), 42); | |
| 3992 ``` | |
| 3993 | |
| 3994 - Added compile-time format string checks to `format_to` overload that | |
| 3995 takes `fmt::memory_buffer` | |
| 3996 (https://github.com/fmtlib/fmt/issues/783): | |
| 3997 | |
| 3998 ```c++ | |
| 3999 fmt::memory_buffer buf; | |
| 4000 // Compile-time error: invalid type specifier. | |
| 4001 fmt::format_to(buf, fmt("{:d}"), "foo"); | |
| 4002 ``` | |
| 4003 | |
| 4004 - Moved experimental color support to `fmt/color.h` and enabled the | |
| 4005 new API by default. The old API can be enabled by defining the | |
| 4006 `FMT_DEPRECATED_COLORS` macro. | |
| 4007 | |
| 4008 - Added formatting support for types explicitly convertible to | |
| 4009 `fmt::string_view`: | |
| 4010 | |
| 4011 ```c++ | |
| 4012 struct foo { | |
| 4013 explicit operator fmt::string_view() const { return "foo"; } | |
| 4014 }; | |
| 4015 auto s = format("{}", foo()); | |
| 4016 ``` | |
| 4017 | |
| 4018 In particular, this makes formatting function work with | |
| 4019 `folly::StringPiece`. | |
| 4020 | |
| 4021 - Implemented preliminary support for `char*_t` by replacing the | |
| 4022 `format` function overloads with a single function template | |
| 4023 parameterized on the string type. | |
| 4024 | |
| 4025 - Added support for dynamic argument lists | |
| 4026 (https://github.com/fmtlib/fmt/issues/814, | |
| 4027 https://github.com/fmtlib/fmt/pull/819). Thanks @MikePopoloski. | |
| 4028 | |
| 4029 - Reduced executable size overhead for embedded targets using newlib | |
| 4030 nano by making locale dependency optional | |
| 4031 (https://github.com/fmtlib/fmt/pull/839). Thanks @teajay-fr. | |
| 4032 | |
| 4033 - Keep `noexcept` specifier when exceptions are disabled | |
| 4034 (https://github.com/fmtlib/fmt/issues/801, | |
| 4035 https://github.com/fmtlib/fmt/pull/810). Thanks @qis. | |
| 4036 | |
| 4037 - Fixed formatting of user-defined types providing `operator<<` with | |
| 4038 `format_to_n` (https://github.com/fmtlib/fmt/pull/806). | |
| 4039 Thanks @mkurdej. | |
| 4040 | |
| 4041 - Fixed dynamic linkage of new symbols | |
| 4042 (https://github.com/fmtlib/fmt/issues/808). | |
| 4043 | |
| 4044 - Fixed global initialization issue | |
| 4045 (https://github.com/fmtlib/fmt/issues/807): | |
| 4046 | |
| 4047 ```c++ | |
| 4048 // This works on compilers with constexpr support. | |
| 4049 static const std::string answer = fmt::format("{}", 42); | |
| 4050 ``` | |
| 4051 | |
| 4052 - Fixed various compiler warnings and errors | |
| 4053 (https://github.com/fmtlib/fmt/pull/804, | |
| 4054 https://github.com/fmtlib/fmt/issues/809, | |
| 4055 https://github.com/fmtlib/fmt/pull/811, | |
| 4056 https://github.com/fmtlib/fmt/issues/822, | |
| 4057 https://github.com/fmtlib/fmt/pull/827, | |
| 4058 https://github.com/fmtlib/fmt/issues/830, | |
| 4059 https://github.com/fmtlib/fmt/pull/838, | |
| 4060 https://github.com/fmtlib/fmt/issues/843, | |
| 4061 https://github.com/fmtlib/fmt/pull/844, | |
| 4062 https://github.com/fmtlib/fmt/issues/851, | |
| 4063 https://github.com/fmtlib/fmt/pull/852, | |
| 4064 https://github.com/fmtlib/fmt/pull/854). | |
| 4065 Thanks @henryiii, @medithe, and @eliasdaler. | |
| 4066 | |
| 4067 # 5.1.0 - 2018-07-05 | |
| 4068 | |
| 4069 - Added experimental support for RGB color output enabled with the | |
| 4070 `FMT_EXTENDED_COLORS` macro: | |
| 4071 | |
| 4072 ```c++ | |
| 4073 #define FMT_EXTENDED_COLORS | |
| 4074 #define FMT_HEADER_ONLY // or compile fmt with FMT_EXTENDED_COLORS defined | |
| 4075 #include <fmt/format.h> | |
| 4076 | |
| 4077 fmt::print(fmt::color::steel_blue, "Some beautiful text"); | |
| 4078 ``` | |
| 4079 | |
| 4080 The old API (the `print_colored` and `vprint_colored` functions and | |
| 4081 the `color` enum) is now deprecated. | |
| 4082 (https://github.com/fmtlib/fmt/issues/762 | |
| 4083 https://github.com/fmtlib/fmt/pull/767). thanks @Remotion. | |
| 4084 | |
| 4085 - Added quotes to strings in ranges and tuples | |
| 4086 (https://github.com/fmtlib/fmt/pull/766). Thanks @Remotion. | |
| 4087 | |
| 4088 - Made `format_to` work with `basic_memory_buffer` | |
| 4089 (https://github.com/fmtlib/fmt/issues/776). | |
| 4090 | |
| 4091 - Added `vformat_to_n` and `wchar_t` overload of `format_to_n` | |
| 4092 (https://github.com/fmtlib/fmt/issues/764, | |
| 4093 https://github.com/fmtlib/fmt/issues/769). | |
| 4094 | |
| 4095 - Made `is_range` and `is_tuple_like` part of public (experimental) | |
| 4096 API to allow specialization for user-defined types | |
| 4097 (https://github.com/fmtlib/fmt/issues/751, | |
| 4098 https://github.com/fmtlib/fmt/pull/759). Thanks @drrlvn. | |
| 4099 | |
| 4100 - Added more compilers to continuous integration and increased | |
| 4101 `FMT_PEDANTIC` warning levels | |
| 4102 (https://github.com/fmtlib/fmt/pull/736). Thanks @eliaskosunen. | |
| 4103 | |
| 4104 - Fixed compilation with MSVC 2013. | |
| 4105 | |
| 4106 - Fixed handling of user-defined types in `format_to` | |
| 4107 (https://github.com/fmtlib/fmt/issues/793). | |
| 4108 | |
| 4109 - Forced linking of inline `vformat` functions into the library | |
| 4110 (https://github.com/fmtlib/fmt/issues/795). | |
| 4111 | |
| 4112 - Fixed incorrect call to on_align in `'{:}='` | |
| 4113 (https://github.com/fmtlib/fmt/issues/750). | |
| 4114 | |
| 4115 - Fixed floating-point formatting to a non-back_insert_iterator with | |
| 4116 sign & numeric alignment specified | |
| 4117 (https://github.com/fmtlib/fmt/issues/756). | |
| 4118 | |
| 4119 - Fixed formatting to an array with `format_to_n` | |
| 4120 (https://github.com/fmtlib/fmt/issues/778). | |
| 4121 | |
| 4122 - Fixed formatting of more than 15 named arguments | |
| 4123 (https://github.com/fmtlib/fmt/issues/754). | |
| 4124 | |
| 4125 - Fixed handling of compile-time strings when including | |
| 4126 `fmt/ostream.h`. (https://github.com/fmtlib/fmt/issues/768). | |
| 4127 | |
| 4128 - Fixed various compiler warnings and errors | |
| 4129 (https://github.com/fmtlib/fmt/issues/742, | |
| 4130 https://github.com/fmtlib/fmt/issues/748, | |
| 4131 https://github.com/fmtlib/fmt/issues/752, | |
| 4132 https://github.com/fmtlib/fmt/issues/770, | |
| 4133 https://github.com/fmtlib/fmt/pull/775, | |
| 4134 https://github.com/fmtlib/fmt/issues/779, | |
| 4135 https://github.com/fmtlib/fmt/pull/780, | |
| 4136 https://github.com/fmtlib/fmt/pull/790, | |
| 4137 https://github.com/fmtlib/fmt/pull/792, | |
| 4138 https://github.com/fmtlib/fmt/pull/800). | |
| 4139 Thanks @Remotion, @gabime, @foonathan, @Dark-Passenger and @0x8000-0000. | |
| 4140 | |
| 4141 # 5.0.0 - 2018-05-21 | |
| 4142 | |
| 4143 - Added a requirement for partial C++11 support, most importantly | |
| 4144 variadic templates and type traits, and dropped `FMT_VARIADIC_*` | |
| 4145 emulation macros. Variadic templates are available since GCC 4.4, | |
| 4146 Clang 2.9 and MSVC 18.0 (2013). For older compilers use {fmt} | |
| 4147 [version 4.x](https://github.com/fmtlib/fmt/releases/tag/4.1.0) | |
| 4148 which continues to be maintained and works with C++98 compilers. | |
| 4149 | |
| 4150 - Renamed symbols to follow standard C++ naming conventions and | |
| 4151 proposed a subset of the library for standardization in [P0645R2 | |
| 4152 Text Formatting](https://wg21.link/P0645). | |
| 4153 | |
| 4154 - Implemented `constexpr` parsing of format strings and [compile-time | |
| 4155 format string | |
| 4156 checks](https://fmt.dev/latest/api.html#compile-time-format-string-checks). | |
| 4157 For example | |
| 4158 | |
| 4159 ```c++ | |
| 4160 #include <fmt/format.h> | |
| 4161 | |
| 4162 std::string s = format(fmt("{:d}"), "foo"); | |
| 4163 ``` | |
| 4164 | |
| 4165 gives a compile-time error because `d` is an invalid specifier for | |
| 4166 strings ([godbolt](https://godbolt.org/g/rnCy9Q)): | |
| 4167 | |
| 4168 ... | |
| 4169 <source>:4:19: note: in instantiation of function template specialization 'fmt::v5::format<S, char [4]>' requested here | |
| 4170 std::string s = format(fmt("{:d}"), "foo"); | |
| 4171 ^ | |
| 4172 format.h:1337:13: note: non-constexpr function 'on_error' cannot be used in a constant expression | |
| 4173 handler.on_error("invalid type specifier"); | |
| 4174 | |
| 4175 Compile-time checks require relaxed `constexpr` (C++14 feature) | |
| 4176 support. If the latter is not available, checks will be performed at | |
| 4177 runtime. | |
| 4178 | |
| 4179 - Separated format string parsing and formatting in the extension API | |
| 4180 to enable compile-time format string processing. For example | |
| 4181 | |
| 4182 ```c++ | |
| 4183 struct Answer {}; | |
| 4184 | |
| 4185 namespace fmt { | |
| 4186 template <> | |
| 4187 struct formatter<Answer> { | |
| 4188 constexpr auto parse(parse_context& ctx) { | |
| 4189 auto it = ctx.begin(); | |
| 4190 spec = *it; | |
| 4191 if (spec != 'd' && spec != 's') | |
| 4192 throw format_error("invalid specifier"); | |
| 4193 return ++it; | |
| 4194 } | |
| 4195 | |
| 4196 template <typename FormatContext> | |
| 4197 auto format(Answer, FormatContext& ctx) { | |
| 4198 return spec == 's' ? | |
| 4199 format_to(ctx.begin(), "{}", "fourty-two") : | |
| 4200 format_to(ctx.begin(), "{}", 42); | |
| 4201 } | |
| 4202 | |
| 4203 char spec = 0; | |
| 4204 }; | |
| 4205 } | |
| 4206 | |
| 4207 std::string s = format(fmt("{:x}"), Answer()); | |
| 4208 ``` | |
| 4209 | |
| 4210 gives a compile-time error due to invalid format specifier | |
| 4211 ([godbolt](https://godbolt.org/g/2jQ1Dv)): | |
| 4212 | |
| 4213 ... | |
| 4214 <source>:12:45: error: expression '<throw-expression>' is not a constant expression | |
| 4215 throw format_error("invalid specifier"); | |
| 4216 | |
| 4217 - Added [iterator | |
| 4218 support](https://fmt.dev/latest/api.html#output-iterator-support): | |
| 4219 | |
| 4220 ```c++ | |
| 4221 #include <vector> | |
| 4222 #include <fmt/format.h> | |
| 4223 | |
| 4224 std::vector<char> out; | |
| 4225 fmt::format_to(std::back_inserter(out), "{}", 42); | |
| 4226 ``` | |
| 4227 | |
| 4228 - Added the | |
| 4229 [format_to_n](https://fmt.dev/latest/api.html#_CPPv2N3fmt11format_to_nE8OutputItNSt6size_tE11string_viewDpRK4Args) | |
| 4230 function that restricts the output to the specified number of | |
| 4231 characters (https://github.com/fmtlib/fmt/issues/298): | |
| 4232 | |
| 4233 ```c++ | |
| 4234 char out[4]; | |
| 4235 fmt::format_to_n(out, sizeof(out), "{}", 12345); | |
| 4236 // out == "1234" (without terminating '\0') | |
| 4237 ``` | |
| 4238 | |
| 4239 - Added the [formatted_size]( | |
| 4240 https://fmt.dev/latest/api.html#_CPPv2N3fmt14formatted_sizeE11string_viewDpRK4Args) | |
| 4241 function for computing the output size: | |
| 4242 | |
| 4243 ```c++ | |
| 4244 #include <fmt/format.h> | |
| 4245 | |
| 4246 auto size = fmt::formatted_size("{}", 12345); // size == 5 | |
| 4247 ``` | |
| 4248 | |
| 4249 - Improved compile times by reducing dependencies on standard headers | |
| 4250 and providing a lightweight [core | |
| 4251 API](https://fmt.dev/latest/api.html#core-api): | |
| 4252 | |
| 4253 ```c++ | |
| 4254 #include <fmt/core.h> | |
| 4255 | |
| 4256 fmt::print("The answer is {}.", 42); | |
| 4257 ``` | |
| 4258 | |
| 4259 See [Compile time and code | |
| 4260 bloat](https://github.com/fmtlib/fmt#compile-time-and-code-bloat). | |
| 4261 | |
| 4262 - Added the [make_format_args]( | |
| 4263 https://fmt.dev/latest/api.html#_CPPv2N3fmt16make_format_argsEDpRK4Args) | |
| 4264 function for capturing formatting arguments: | |
| 4265 | |
| 4266 ```c++ | |
| 4267 // Prints formatted error message. | |
| 4268 void vreport_error(const char *format, fmt::format_args args) { | |
| 4269 fmt::print("Error: "); | |
| 4270 fmt::vprint(format, args); | |
| 4271 } | |
| 4272 template <typename... Args> | |
| 4273 void report_error(const char *format, const Args & ... args) { | |
| 4274 vreport_error(format, fmt::make_format_args(args...)); | |
| 4275 } | |
| 4276 ``` | |
| 4277 | |
| 4278 - Added the `make_printf_args` function for capturing `printf` | |
| 4279 arguments (https://github.com/fmtlib/fmt/issues/687, | |
| 4280 https://github.com/fmtlib/fmt/pull/694). Thanks @Kronuz. | |
| 4281 | |
| 4282 - Added prefix `v` to non-variadic functions taking `format_args` to | |
| 4283 distinguish them from variadic ones: | |
| 4284 | |
| 4285 ```c++ | |
| 4286 std::string vformat(string_view format_str, format_args args); | |
| 4287 | |
| 4288 template <typename... Args> | |
| 4289 std::string format(string_view format_str, const Args & ... args); | |
| 4290 ``` | |
| 4291 | |
| 4292 - Added experimental support for formatting ranges, containers and | |
| 4293 tuple-like types in `fmt/ranges.h` | |
| 4294 (https://github.com/fmtlib/fmt/pull/735): | |
| 4295 | |
| 4296 ```c++ | |
| 4297 #include <fmt/ranges.h> | |
| 4298 | |
| 4299 std::vector<int> v = {1, 2, 3}; | |
| 4300 fmt::print("{}", v); // prints {1, 2, 3} | |
| 4301 ``` | |
| 4302 | |
| 4303 Thanks @Remotion. | |
| 4304 | |
| 4305 - Implemented `wchar_t` date and time formatting | |
| 4306 (https://github.com/fmtlib/fmt/pull/712): | |
| 4307 | |
| 4308 ```c++ | |
| 4309 #include <fmt/time.h> | |
| 4310 | |
| 4311 std::time_t t = std::time(nullptr); | |
| 4312 auto s = fmt::format(L"The date is {:%Y-%m-%d}.", *std::localtime(&t)); | |
| 4313 ``` | |
| 4314 | |
| 4315 Thanks @DanielaE. | |
| 4316 | |
| 4317 - Provided more wide string overloads | |
| 4318 (https://github.com/fmtlib/fmt/pull/724). Thanks @DanielaE. | |
| 4319 | |
| 4320 - Switched from a custom null-terminated string view class to | |
| 4321 `string_view` in the format API and provided `fmt::string_view` | |
| 4322 which implements a subset of `std::string_view` API for pre-C++17 | |
| 4323 systems. | |
| 4324 | |
| 4325 - Added support for `std::experimental::string_view` | |
| 4326 (https://github.com/fmtlib/fmt/pull/607): | |
| 4327 | |
| 4328 ```c++ | |
| 4329 #include <fmt/core.h> | |
| 4330 #include <experimental/string_view> | |
| 4331 | |
| 4332 fmt::print("{}", std::experimental::string_view("foo")); | |
| 4333 ``` | |
| 4334 | |
| 4335 Thanks @virgiliofornazin. | |
| 4336 | |
| 4337 - Allowed mixing named and automatic arguments: | |
| 4338 | |
| 4339 ```c++ | |
| 4340 fmt::format("{} {two}", 1, fmt::arg("two", 2)); | |
| 4341 ``` | |
| 4342 | |
| 4343 - Removed the write API in favor of the [format | |
| 4344 API](https://fmt.dev/latest/api.html#format-api) with compile-time | |
| 4345 handling of format strings. | |
| 4346 | |
| 4347 - Disallowed formatting of multibyte strings into a wide character | |
| 4348 target (https://github.com/fmtlib/fmt/pull/606). | |
| 4349 | |
| 4350 - Improved documentation | |
| 4351 (https://github.com/fmtlib/fmt/pull/515, | |
| 4352 https://github.com/fmtlib/fmt/issues/614, | |
| 4353 https://github.com/fmtlib/fmt/pull/617, | |
| 4354 https://github.com/fmtlib/fmt/pull/661, | |
| 4355 https://github.com/fmtlib/fmt/pull/680). | |
| 4356 Thanks @ibell, @mihaitodor and @johnthagen. | |
| 4357 | |
| 4358 - Implemented more efficient handling of large number of format | |
| 4359 arguments. | |
| 4360 | |
| 4361 - Introduced an inline namespace for symbol versioning. | |
| 4362 | |
| 4363 - Added debug postfix `d` to the `fmt` library name | |
| 4364 (https://github.com/fmtlib/fmt/issues/636). | |
| 4365 | |
| 4366 - Removed unnecessary `fmt/` prefix in includes | |
| 4367 (https://github.com/fmtlib/fmt/pull/397). Thanks @chronoxor. | |
| 4368 | |
| 4369 - Moved `fmt/*.h` to `include/fmt/*.h` to prevent irrelevant files and | |
| 4370 directories appearing on the include search paths when fmt is used | |
| 4371 as a subproject and moved source files to the `src` directory. | |
| 4372 | |
| 4373 - Added qmake project file `support/fmt.pro` | |
| 4374 (https://github.com/fmtlib/fmt/pull/641). Thanks @cowo78. | |
| 4375 | |
| 4376 - Added Gradle build file `support/build.gradle` | |
| 4377 (https://github.com/fmtlib/fmt/pull/649). Thanks @luncliff. | |
| 4378 | |
| 4379 - Removed `FMT_CPPFORMAT` CMake option. | |
| 4380 | |
| 4381 - Fixed a name conflict with the macro `CHAR_WIDTH` in glibc | |
| 4382 (https://github.com/fmtlib/fmt/pull/616). Thanks @aroig. | |
| 4383 | |
| 4384 - Fixed handling of nested braces in `fmt::join` | |
| 4385 (https://github.com/fmtlib/fmt/issues/638). | |
| 4386 | |
| 4387 - Added `SOURCELINK_SUFFIX` for compatibility with Sphinx 1.5 | |
| 4388 (https://github.com/fmtlib/fmt/pull/497). Thanks @ginggs. | |
| 4389 | |
| 4390 - Added a missing `inline` in the header-only mode | |
| 4391 (https://github.com/fmtlib/fmt/pull/626). Thanks @aroig. | |
| 4392 | |
| 4393 - Fixed various compiler warnings | |
| 4394 (https://github.com/fmtlib/fmt/pull/640, | |
| 4395 https://github.com/fmtlib/fmt/pull/656, | |
| 4396 https://github.com/fmtlib/fmt/pull/679, | |
| 4397 https://github.com/fmtlib/fmt/pull/681, | |
| 4398 https://github.com/fmtlib/fmt/pull/705, | |
| 4399 https://github.com/fmtlib/fmt/issues/715, | |
| 4400 https://github.com/fmtlib/fmt/pull/717, | |
| 4401 https://github.com/fmtlib/fmt/pull/720, | |
| 4402 https://github.com/fmtlib/fmt/pull/723, | |
| 4403 https://github.com/fmtlib/fmt/pull/726, | |
| 4404 https://github.com/fmtlib/fmt/pull/730, | |
| 4405 https://github.com/fmtlib/fmt/pull/739). | |
| 4406 Thanks @peterbell10, @LarsGullik, @foonathan, @eliaskosunen, | |
| 4407 @christianparpart, @DanielaE and @mwinterb. | |
| 4408 | |
| 4409 - Worked around an MSVC bug and fixed several warnings | |
| 4410 (https://github.com/fmtlib/fmt/pull/653). Thanks @alabuzhev. | |
| 4411 | |
| 4412 - Worked around GCC bug 67371 | |
| 4413 (https://github.com/fmtlib/fmt/issues/682). | |
| 4414 | |
| 4415 - Fixed compilation with `-fno-exceptions` | |
| 4416 (https://github.com/fmtlib/fmt/pull/655). Thanks @chenxiaolong. | |
| 4417 | |
| 4418 - Made `constexpr remove_prefix` gcc version check tighter | |
| 4419 (https://github.com/fmtlib/fmt/issues/648). | |
| 4420 | |
| 4421 - Renamed internal type enum constants to prevent collision with | |
| 4422 poorly written C libraries | |
| 4423 (https://github.com/fmtlib/fmt/issues/644). | |
| 4424 | |
| 4425 - Added detection of `wostream operator<<` | |
| 4426 (https://github.com/fmtlib/fmt/issues/650). | |
| 4427 | |
| 4428 - Fixed compilation on OpenBSD | |
| 4429 (https://github.com/fmtlib/fmt/pull/660). Thanks @hubslave. | |
| 4430 | |
| 4431 - Fixed compilation on FreeBSD 12 | |
| 4432 (https://github.com/fmtlib/fmt/pull/732). Thanks @dankm. | |
| 4433 | |
| 4434 - Fixed compilation when there is a mismatch between `-std` options | |
| 4435 between the library and user code | |
| 4436 (https://github.com/fmtlib/fmt/issues/664). | |
| 4437 | |
| 4438 - Fixed compilation with GCC 7 and `-std=c++11` | |
| 4439 (https://github.com/fmtlib/fmt/issues/734). | |
| 4440 | |
| 4441 - Improved generated binary code on GCC 7 and older | |
| 4442 (https://github.com/fmtlib/fmt/issues/668). | |
| 4443 | |
| 4444 - Fixed handling of numeric alignment with no width | |
| 4445 (https://github.com/fmtlib/fmt/issues/675). | |
| 4446 | |
| 4447 - Fixed handling of empty strings in UTF8/16 converters | |
| 4448 (https://github.com/fmtlib/fmt/pull/676). Thanks @vgalka-sl. | |
| 4449 | |
| 4450 - Fixed formatting of an empty `string_view` | |
| 4451 (https://github.com/fmtlib/fmt/issues/689). | |
| 4452 | |
| 4453 - Fixed detection of `string_view` on libc++ | |
| 4454 (https://github.com/fmtlib/fmt/issues/686). | |
| 4455 | |
| 4456 - Fixed DLL issues (https://github.com/fmtlib/fmt/pull/696). | |
| 4457 Thanks @sebkoenig. | |
| 4458 | |
| 4459 - Fixed compile checks for mixing narrow and wide strings | |
| 4460 (https://github.com/fmtlib/fmt/issues/690). | |
| 4461 | |
| 4462 - Disabled unsafe implicit conversion to `std::string` | |
| 4463 (https://github.com/fmtlib/fmt/issues/729). | |
| 4464 | |
| 4465 - Fixed handling of reused format specs (as in `fmt::join`) for | |
| 4466 pointers (https://github.com/fmtlib/fmt/pull/725). Thanks @mwinterb. | |
| 4467 | |
| 4468 - Fixed installation of `fmt/ranges.h` | |
| 4469 (https://github.com/fmtlib/fmt/pull/738). Thanks @sv1990. | |
| 4470 | |
| 4471 # 4.1.0 - 2017-12-20 | |
| 4472 | |
| 4473 - Added `fmt::to_wstring()` in addition to `fmt::to_string()` | |
| 4474 (https://github.com/fmtlib/fmt/pull/559). Thanks @alabuzhev. | |
| 4475 - Added support for C++17 `std::string_view` | |
| 4476 (https://github.com/fmtlib/fmt/pull/571 and | |
| 4477 https://github.com/fmtlib/fmt/pull/578). | |
| 4478 Thanks @thelostt and @mwinterb. | |
| 4479 - Enabled stream exceptions to catch errors | |
| 4480 (https://github.com/fmtlib/fmt/issues/581). Thanks @crusader-mike. | |
| 4481 - Allowed formatting of class hierarchies with `fmt::format_arg()` | |
| 4482 (https://github.com/fmtlib/fmt/pull/547). Thanks @rollbear. | |
| 4483 - Removed limitations on character types | |
| 4484 (https://github.com/fmtlib/fmt/pull/563). Thanks @Yelnats321. | |
| 4485 - Conditionally enabled use of `std::allocator_traits` | |
| 4486 (https://github.com/fmtlib/fmt/pull/583). Thanks @mwinterb. | |
| 4487 - Added support for `const` variadic member function emulation with | |
| 4488 `FMT_VARIADIC_CONST` | |
| 4489 (https://github.com/fmtlib/fmt/pull/591). Thanks @ludekvodicka. | |
| 4490 - Various bugfixes: bad overflow check, unsupported implicit type | |
| 4491 conversion when determining formatting function, test segfaults | |
| 4492 (https://github.com/fmtlib/fmt/issues/551), ill-formed | |
| 4493 macros (https://github.com/fmtlib/fmt/pull/542) and | |
| 4494 ambiguous overloads | |
| 4495 (https://github.com/fmtlib/fmt/issues/580). Thanks @xylosper. | |
| 4496 - Prevented warnings on MSVC | |
| 4497 (https://github.com/fmtlib/fmt/pull/605, | |
| 4498 https://github.com/fmtlib/fmt/pull/602, and | |
| 4499 https://github.com/fmtlib/fmt/pull/545), clang | |
| 4500 (https://github.com/fmtlib/fmt/pull/582), GCC | |
| 4501 (https://github.com/fmtlib/fmt/issues/573), various | |
| 4502 conversion warnings (https://github.com/fmtlib/fmt/pull/609, | |
| 4503 https://github.com/fmtlib/fmt/pull/567, | |
| 4504 https://github.com/fmtlib/fmt/pull/553 and | |
| 4505 https://github.com/fmtlib/fmt/pull/553), and added | |
| 4506 `override` and `[[noreturn]]` | |
| 4507 (https://github.com/fmtlib/fmt/pull/549 and | |
| 4508 https://github.com/fmtlib/fmt/issues/555). | |
| 4509 Thanks @alabuzhev, @virgiliofornazin, @alexanderbock, @yumetodo, @VaderY, | |
| 4510 @jpcima, @thelostt and @Manu343726. | |
| 4511 - Improved CMake: Used `GNUInstallDirs` to set installation location | |
| 4512 (https://github.com/fmtlib/fmt/pull/610) and fixed warnings | |
| 4513 (https://github.com/fmtlib/fmt/pull/536 and | |
| 4514 https://github.com/fmtlib/fmt/pull/556). | |
| 4515 Thanks @mikecrowe, @evgen231 and @henryiii. | |
| 4516 | |
| 4517 # 4.0.0 - 2017-06-27 | |
| 4518 | |
| 4519 - Removed old compatibility headers `cppformat/*.h` and CMake options | |
| 4520 (https://github.com/fmtlib/fmt/pull/527). Thanks @maddinat0r. | |
| 4521 | |
| 4522 - Added `string.h` containing `fmt::to_string()` as alternative to | |
| 4523 `std::to_string()` as well as other string writer functionality | |
| 4524 (https://github.com/fmtlib/fmt/issues/326 and | |
| 4525 https://github.com/fmtlib/fmt/pull/441): | |
| 4526 | |
| 4527 ```c++ | |
| 4528 #include "fmt/string.h" | |
| 4529 | |
| 4530 std::string answer = fmt::to_string(42); | |
| 4531 ``` | |
| 4532 | |
| 4533 Thanks @glebov-andrey. | |
| 4534 | |
| 4535 - Moved `fmt::printf()` to new `printf.h` header and allowed `%s` as | |
| 4536 generic specifier (https://github.com/fmtlib/fmt/pull/453), | |
| 4537 made `%.f` more conformant to regular `printf()` | |
| 4538 (https://github.com/fmtlib/fmt/pull/490), added custom | |
| 4539 writer support (https://github.com/fmtlib/fmt/issues/476) | |
| 4540 and implemented missing custom argument formatting | |
| 4541 (https://github.com/fmtlib/fmt/pull/339 and | |
| 4542 https://github.com/fmtlib/fmt/pull/340): | |
| 4543 | |
| 4544 ```c++ | |
| 4545 #include "fmt/printf.h" | |
| 4546 | |
| 4547 // %s format specifier can be used with any argument type. | |
| 4548 fmt::printf("%s", 42); | |
| 4549 ``` | |
| 4550 | |
| 4551 Thanks @mojoBrendan, @manylegged and @spacemoose. | |
| 4552 See also https://github.com/fmtlib/fmt/issues/360, | |
| 4553 https://github.com/fmtlib/fmt/issues/335 and | |
| 4554 https://github.com/fmtlib/fmt/issues/331. | |
| 4555 | |
| 4556 - Added `container.h` containing a `BasicContainerWriter` to write to | |
| 4557 containers like `std::vector` | |
| 4558 (https://github.com/fmtlib/fmt/pull/450). Thanks @polyvertex. | |
| 4559 | |
| 4560 - Added `fmt::join()` function that takes a range and formats its | |
| 4561 elements separated by a given string | |
| 4562 (https://github.com/fmtlib/fmt/pull/466): | |
| 4563 | |
| 4564 ```c++ | |
| 4565 #include "fmt/format.h" | |
| 4566 | |
| 4567 std::vector<double> v = {1.2, 3.4, 5.6}; | |
| 4568 // Prints "(+01.20, +03.40, +05.60)". | |
| 4569 fmt::print("({:+06.2f})", fmt::join(v.begin(), v.end(), ", ")); | |
| 4570 ``` | |
| 4571 | |
| 4572 Thanks @olivier80. | |
| 4573 | |
| 4574 - Added support for custom formatting specifications to simplify | |
| 4575 customization of built-in formatting | |
| 4576 (https://github.com/fmtlib/fmt/pull/444). Thanks @polyvertex. | |
| 4577 See also https://github.com/fmtlib/fmt/issues/439. | |
| 4578 | |
| 4579 - Added `fmt::format_system_error()` for error code formatting | |
| 4580 (https://github.com/fmtlib/fmt/issues/323 and | |
| 4581 https://github.com/fmtlib/fmt/pull/526). Thanks @maddinat0r. | |
| 4582 | |
| 4583 - Added thread-safe `fmt::localtime()` and `fmt::gmtime()` as | |
| 4584 replacement for the standard version to `time.h` | |
| 4585 (https://github.com/fmtlib/fmt/pull/396). Thanks @codicodi. | |
| 4586 | |
| 4587 - Internal improvements to `NamedArg` and `ArgLists` | |
| 4588 (https://github.com/fmtlib/fmt/pull/389 and | |
| 4589 https://github.com/fmtlib/fmt/pull/390). Thanks @chronoxor. | |
| 4590 | |
| 4591 - Fixed crash due to bug in `FormatBuf` | |
| 4592 (https://github.com/fmtlib/fmt/pull/493). Thanks @effzeh. See also | |
| 4593 https://github.com/fmtlib/fmt/issues/480 and | |
| 4594 https://github.com/fmtlib/fmt/issues/491. | |
| 4595 | |
| 4596 - Fixed handling of wide strings in `fmt::StringWriter`. | |
| 4597 | |
| 4598 - Improved compiler error messages | |
| 4599 (https://github.com/fmtlib/fmt/issues/357). | |
| 4600 | |
| 4601 - Fixed various warnings and issues with various compilers | |
| 4602 (https://github.com/fmtlib/fmt/pull/494, | |
| 4603 https://github.com/fmtlib/fmt/pull/499, | |
| 4604 https://github.com/fmtlib/fmt/pull/483, | |
| 4605 https://github.com/fmtlib/fmt/pull/485, | |
| 4606 https://github.com/fmtlib/fmt/pull/482, | |
| 4607 https://github.com/fmtlib/fmt/pull/475, | |
| 4608 https://github.com/fmtlib/fmt/pull/473 and | |
| 4609 https://github.com/fmtlib/fmt/pull/414). | |
| 4610 Thanks @chronoxor, @zhaohuaxishi, @pkestene, @dschmidt and @0x414c. | |
| 4611 | |
| 4612 - Improved CMake: targets are now namespaced | |
| 4613 (https://github.com/fmtlib/fmt/pull/511 and | |
| 4614 https://github.com/fmtlib/fmt/pull/513), supported | |
| 4615 header-only `printf.h` | |
| 4616 (https://github.com/fmtlib/fmt/pull/354), fixed issue with | |
| 4617 minimal supported library subset | |
| 4618 (https://github.com/fmtlib/fmt/issues/418, | |
| 4619 https://github.com/fmtlib/fmt/pull/419 and | |
| 4620 https://github.com/fmtlib/fmt/pull/420). | |
| 4621 Thanks @bjoernthiel, @niosHD, @LogicalKnight and @alabuzhev. | |
| 4622 | |
| 4623 - Improved documentation (https://github.com/fmtlib/fmt/pull/393). | |
| 4624 Thanks @pwm1234. | |
| 4625 | |
| 4626 # 3.0.2 - 2017-06-14 | |
| 4627 | |
| 4628 - Added `FMT_VERSION` macro | |
| 4629 (https://github.com/fmtlib/fmt/issues/411). | |
| 4630 - Used `FMT_NULL` instead of literal `0` | |
| 4631 (https://github.com/fmtlib/fmt/pull/409). Thanks @alabuzhev. | |
| 4632 - Added extern templates for `format_float` | |
| 4633 (https://github.com/fmtlib/fmt/issues/413). | |
| 4634 - Fixed implicit conversion issue | |
| 4635 (https://github.com/fmtlib/fmt/issues/507). | |
| 4636 - Fixed signbit detection | |
| 4637 (https://github.com/fmtlib/fmt/issues/423). | |
| 4638 - Fixed naming collision | |
| 4639 (https://github.com/fmtlib/fmt/issues/425). | |
| 4640 - Fixed missing intrinsic for C++/CLI | |
| 4641 (https://github.com/fmtlib/fmt/pull/457). Thanks @calumr. | |
| 4642 - Fixed Android detection | |
| 4643 (https://github.com/fmtlib/fmt/pull/458). Thanks @Gachapen. | |
| 4644 - Use lean `windows.h` if not in header-only mode | |
| 4645 (https://github.com/fmtlib/fmt/pull/503). Thanks @Quentin01. | |
| 4646 - Fixed issue with CMake exporting C++11 flag | |
| 4647 (https://github.com/fmtlib/fmt/pull/455). Thanks @EricWF. | |
| 4648 - Fixed issue with nvcc and MSVC compiler bug and MinGW | |
| 4649 (https://github.com/fmtlib/fmt/issues/505). | |
| 4650 - Fixed DLL issues (https://github.com/fmtlib/fmt/pull/469 and | |
| 4651 https://github.com/fmtlib/fmt/pull/502). | |
| 4652 Thanks @richardeakin and @AndreasSchoenle. | |
| 4653 - Fixed test compilation under FreeBSD | |
| 4654 (https://github.com/fmtlib/fmt/issues/433). | |
| 4655 - Fixed various warnings | |
| 4656 (https://github.com/fmtlib/fmt/pull/403, | |
| 4657 https://github.com/fmtlib/fmt/pull/410 and | |
| 4658 https://github.com/fmtlib/fmt/pull/510). | |
| 4659 Thanks @Lecetem, @chenhayat and @trozen. | |
| 4660 - Worked around a broken `__builtin_clz` in clang with MS codegen | |
| 4661 (https://github.com/fmtlib/fmt/issues/519). | |
| 4662 - Removed redundant include | |
| 4663 (https://github.com/fmtlib/fmt/issues/479). | |
| 4664 - Fixed documentation issues. | |
| 4665 | |
| 4666 # 3.0.1 - 2016-11-01 | |
| 4667 | |
| 4668 - Fixed handling of thousands separator | |
| 4669 (https://github.com/fmtlib/fmt/issues/353). | |
| 4670 - Fixed handling of `unsigned char` strings | |
| 4671 (https://github.com/fmtlib/fmt/issues/373). | |
| 4672 - Corrected buffer growth when formatting time | |
| 4673 (https://github.com/fmtlib/fmt/issues/367). | |
| 4674 - Removed warnings under MSVC and clang | |
| 4675 (https://github.com/fmtlib/fmt/issues/318, | |
| 4676 https://github.com/fmtlib/fmt/issues/250, also merged | |
| 4677 https://github.com/fmtlib/fmt/pull/385 and | |
| 4678 https://github.com/fmtlib/fmt/pull/361). | |
| 4679 Thanks @jcelerier and @nmoehrle. | |
| 4680 - Fixed compilation issues under Android | |
| 4681 (https://github.com/fmtlib/fmt/pull/327, | |
| 4682 https://github.com/fmtlib/fmt/issues/345 and | |
| 4683 https://github.com/fmtlib/fmt/pull/381), FreeBSD | |
| 4684 (https://github.com/fmtlib/fmt/pull/358), Cygwin | |
| 4685 (https://github.com/fmtlib/fmt/issues/388), MinGW | |
| 4686 (https://github.com/fmtlib/fmt/issues/355) as well as other | |
| 4687 issues (https://github.com/fmtlib/fmt/issues/350, | |
| 4688 https://github.com/fmtlib/fmt/issues/355, | |
| 4689 https://github.com/fmtlib/fmt/pull/348, | |
| 4690 https://github.com/fmtlib/fmt/pull/402, | |
| 4691 https://github.com/fmtlib/fmt/pull/405). | |
| 4692 Thanks @dpantele, @hghwng, @arvedarved, @LogicalKnight and @JanHellwig. | |
| 4693 - Fixed some documentation issues and extended specification | |
| 4694 (https://github.com/fmtlib/fmt/issues/320, | |
| 4695 https://github.com/fmtlib/fmt/pull/333, | |
| 4696 https://github.com/fmtlib/fmt/issues/347, | |
| 4697 https://github.com/fmtlib/fmt/pull/362). Thanks @smellman. | |
| 4698 | |
| 4699 # 3.0.0 - 2016-05-07 | |
| 4700 | |
| 4701 - The project has been renamed from C++ Format (cppformat) to fmt for | |
| 4702 consistency with the used namespace and macro prefix | |
| 4703 (https://github.com/fmtlib/fmt/issues/307). Library headers | |
| 4704 are now located in the `fmt` directory: | |
| 4705 | |
| 4706 ```c++ | |
| 4707 #include "fmt/format.h" | |
| 4708 ``` | |
| 4709 | |
| 4710 Including `format.h` from the `cppformat` directory is deprecated | |
| 4711 but works via a proxy header which will be removed in the next major | |
| 4712 version. | |
| 4713 | |
| 4714 The documentation is now available at <https://fmt.dev>. | |
| 4715 | |
| 4716 - Added support for | |
| 4717 [strftime](http://en.cppreference.com/w/cpp/chrono/c/strftime)-like | |
| 4718 [date and time | |
| 4719 formatting](https://fmt.dev/3.0.0/api.html#date-and-time-formatting) | |
| 4720 (https://github.com/fmtlib/fmt/issues/283): | |
| 4721 | |
| 4722 ```c++ | |
| 4723 #include "fmt/time.h" | |
| 4724 | |
| 4725 std::time_t t = std::time(nullptr); | |
| 4726 // Prints "The date is 2016-04-29." (with the current date) | |
| 4727 fmt::print("The date is {:%Y-%m-%d}.", *std::localtime(&t)); | |
| 4728 ``` | |
| 4729 | |
| 4730 - `std::ostream` support including formatting of user-defined types | |
| 4731 that provide overloaded `operator<<` has been moved to | |
| 4732 `fmt/ostream.h`: | |
| 4733 | |
| 4734 ```c++ | |
| 4735 #include "fmt/ostream.h" | |
| 4736 | |
| 4737 class Date { | |
| 4738 int year_, month_, day_; | |
| 4739 public: | |
| 4740 Date(int year, int month, int day) : year_(year), month_(month), day_(day) {} | |
| 4741 | |
| 4742 friend std::ostream &operator<<(std::ostream &os, const Date &d) { | |
| 4743 return os << d.year_ << '-' << d.month_ << '-' << d.day_; | |
| 4744 } | |
| 4745 }; | |
| 4746 | |
| 4747 std::string s = fmt::format("The date is {}", Date(2012, 12, 9)); | |
| 4748 // s == "The date is 2012-12-9" | |
| 4749 ``` | |
| 4750 | |
| 4751 - Added support for [custom argument | |
| 4752 formatters](https://fmt.dev/3.0.0/api.html#argument-formatters) | |
| 4753 (https://github.com/fmtlib/fmt/issues/235). | |
| 4754 | |
| 4755 - Added support for locale-specific integer formatting with the `n` | |
| 4756 specifier (https://github.com/fmtlib/fmt/issues/305): | |
| 4757 | |
| 4758 ```c++ | |
| 4759 std::setlocale(LC_ALL, "en_US.utf8"); | |
| 4760 fmt::print("cppformat: {:n}\n", 1234567); // prints 1,234,567 | |
| 4761 ``` | |
| 4762 | |
| 4763 - Sign is now preserved when formatting an integer with an incorrect | |
| 4764 `printf` format specifier | |
| 4765 (https://github.com/fmtlib/fmt/issues/265): | |
| 4766 | |
| 4767 ```c++ | |
| 4768 fmt::printf("%lld", -42); // prints -42 | |
| 4769 ``` | |
| 4770 | |
| 4771 Note that it would be an undefined behavior in `std::printf`. | |
| 4772 | |
| 4773 - Length modifiers such as `ll` are now optional in printf formatting | |
| 4774 functions and the correct type is determined automatically | |
| 4775 (https://github.com/fmtlib/fmt/issues/255): | |
| 4776 | |
| 4777 ```c++ | |
| 4778 fmt::printf("%d", std::numeric_limits<long long>::max()); | |
| 4779 ``` | |
| 4780 | |
| 4781 Note that it would be an undefined behavior in `std::printf`. | |
| 4782 | |
| 4783 - Added initial support for custom formatters | |
| 4784 (https://github.com/fmtlib/fmt/issues/231). | |
| 4785 | |
| 4786 - Fixed detection of user-defined literal support on Intel C++ | |
| 4787 compiler (https://github.com/fmtlib/fmt/issues/311, | |
| 4788 https://github.com/fmtlib/fmt/pull/312). | |
| 4789 Thanks @dean0x7d and @speth. | |
| 4790 | |
| 4791 - Reduced compile time | |
| 4792 (https://github.com/fmtlib/fmt/pull/243, | |
| 4793 https://github.com/fmtlib/fmt/pull/249, | |
| 4794 https://github.com/fmtlib/fmt/issues/317): | |
| 4795 | |
| 4796  | |
| 4797 | |
| 4798  | |
| 4799 | |
| 4800 Thanks @dean0x7d. | |
| 4801 | |
| 4802 - Compile test fixes (https://github.com/fmtlib/fmt/pull/313). | |
| 4803 Thanks @dean0x7d. | |
| 4804 | |
| 4805 - Documentation fixes (https://github.com/fmtlib/fmt/pull/239, | |
| 4806 https://github.com/fmtlib/fmt/issues/248, | |
| 4807 https://github.com/fmtlib/fmt/issues/252, | |
| 4808 https://github.com/fmtlib/fmt/pull/258, | |
| 4809 https://github.com/fmtlib/fmt/issues/260, | |
| 4810 https://github.com/fmtlib/fmt/issues/301, | |
| 4811 https://github.com/fmtlib/fmt/pull/309). | |
| 4812 Thanks @ReadmeCritic @Gachapen and @jwilk. | |
| 4813 | |
| 4814 - Fixed compiler and sanitizer warnings | |
| 4815 (https://github.com/fmtlib/fmt/issues/244, | |
| 4816 https://github.com/fmtlib/fmt/pull/256, | |
| 4817 https://github.com/fmtlib/fmt/pull/259, | |
| 4818 https://github.com/fmtlib/fmt/issues/263, | |
| 4819 https://github.com/fmtlib/fmt/issues/274, | |
| 4820 https://github.com/fmtlib/fmt/pull/277, | |
| 4821 https://github.com/fmtlib/fmt/pull/286, | |
| 4822 https://github.com/fmtlib/fmt/issues/291, | |
| 4823 https://github.com/fmtlib/fmt/issues/296, | |
| 4824 https://github.com/fmtlib/fmt/issues/308). | |
| 4825 Thanks @mwinterb, @pweiskircher and @Naios. | |
| 4826 | |
| 4827 - Improved compatibility with Windows Store apps | |
| 4828 (https://github.com/fmtlib/fmt/issues/280, | |
| 4829 https://github.com/fmtlib/fmt/pull/285) Thanks @mwinterb. | |
| 4830 | |
| 4831 - Added tests of compatibility with older C++ standards | |
| 4832 (https://github.com/fmtlib/fmt/pull/273). Thanks @niosHD. | |
| 4833 | |
| 4834 - Fixed Android build | |
| 4835 (https://github.com/fmtlib/fmt/pull/271). Thanks @newnon. | |
| 4836 | |
| 4837 - Changed `ArgMap` to be backed by a vector instead of a map. | |
| 4838 (https://github.com/fmtlib/fmt/issues/261, | |
| 4839 https://github.com/fmtlib/fmt/pull/262). Thanks @mwinterb. | |
| 4840 | |
| 4841 - Added `fprintf` overload that writes to a `std::ostream` | |
| 4842 (https://github.com/fmtlib/fmt/pull/251). | |
| 4843 Thanks @nickhutchinson. | |
| 4844 | |
| 4845 - Export symbols when building a Windows DLL | |
| 4846 (https://github.com/fmtlib/fmt/pull/245). | |
| 4847 Thanks @macdems. | |
| 4848 | |
| 4849 - Fixed compilation on Cygwin | |
| 4850 (https://github.com/fmtlib/fmt/issues/304). | |
| 4851 | |
| 4852 - Implemented a workaround for a bug in Apple LLVM version 4.2 of | |
| 4853 clang (https://github.com/fmtlib/fmt/issues/276). | |
| 4854 | |
| 4855 - Implemented a workaround for Google Test bug | |
| 4856 https://github.com/google/googletest/issues/705 on gcc 6 | |
| 4857 (https://github.com/fmtlib/fmt/issues/268). Thanks @octoploid. | |
| 4858 | |
| 4859 - Removed Biicode support because the latter has been discontinued. | |
| 4860 | |
| 4861 # 2.1.1 - 2016-04-11 | |
| 4862 | |
| 4863 - The install location for generated CMake files is now configurable | |
| 4864 via the `FMT_CMAKE_DIR` CMake variable | |
| 4865 (https://github.com/fmtlib/fmt/pull/299). Thanks @niosHD. | |
| 4866 - Documentation fixes | |
| 4867 (https://github.com/fmtlib/fmt/issues/252). | |
| 4868 | |
| 4869 # 2.1.0 - 2016-03-21 | |
| 4870 | |
| 4871 - Project layout and build system improvements | |
| 4872 (https://github.com/fmtlib/fmt/pull/267): | |
| 4873 | |
| 4874 - The code have been moved to the `cppformat` directory. Including | |
| 4875 `format.h` from the top-level directory is deprecated but works | |
| 4876 via a proxy header which will be removed in the next major | |
| 4877 version. | |
| 4878 - C++ Format CMake targets now have proper interface definitions. | |
| 4879 - Installed version of the library now supports the header-only | |
| 4880 configuration. | |
| 4881 - Targets `doc`, `install`, and `test` are now disabled if C++ | |
| 4882 Format is included as a CMake subproject. They can be enabled by | |
| 4883 setting `FMT_DOC`, `FMT_INSTALL`, and `FMT_TEST` in the parent | |
| 4884 project. | |
| 4885 | |
| 4886 Thanks @niosHD. | |
| 4887 | |
| 4888 # 2.0.1 - 2016-03-13 | |
| 4889 | |
| 4890 - Improved CMake find and package support | |
| 4891 (https://github.com/fmtlib/fmt/issues/264). Thanks @niosHD. | |
| 4892 - Fix compile error with Android NDK and mingw32 | |
| 4893 (https://github.com/fmtlib/fmt/issues/241). Thanks @Gachapen. | |
| 4894 - Documentation fixes | |
| 4895 (https://github.com/fmtlib/fmt/issues/248, | |
| 4896 https://github.com/fmtlib/fmt/issues/260). | |
| 4897 | |
| 4898 # 2.0.0 - 2015-12-01 | |
| 4899 | |
| 4900 ## General | |
| 4901 | |
| 4902 - \[Breaking\] Named arguments | |
| 4903 (https://github.com/fmtlib/fmt/pull/169, | |
| 4904 https://github.com/fmtlib/fmt/pull/173, | |
| 4905 https://github.com/fmtlib/fmt/pull/174): | |
| 4906 | |
| 4907 ```c++ | |
| 4908 fmt::print("The answer is {answer}.", fmt::arg("answer", 42)); | |
| 4909 ``` | |
| 4910 | |
| 4911 Thanks @jamboree. | |
| 4912 | |
| 4913 - \[Experimental\] User-defined literals for format and named | |
| 4914 arguments (https://github.com/fmtlib/fmt/pull/204, | |
| 4915 https://github.com/fmtlib/fmt/pull/206, | |
| 4916 https://github.com/fmtlib/fmt/pull/207): | |
| 4917 | |
| 4918 ```c++ | |
| 4919 using namespace fmt::literals; | |
| 4920 fmt::print("The answer is {answer}.", "answer"_a=42); | |
| 4921 ``` | |
| 4922 | |
| 4923 Thanks @dean0x7d. | |
| 4924 | |
| 4925 - \[Breaking\] Formatting of more than 16 arguments is now supported | |
| 4926 when using variadic templates | |
| 4927 (https://github.com/fmtlib/fmt/issues/141). Thanks @Shauren. | |
| 4928 | |
| 4929 - Runtime width specification | |
| 4930 (https://github.com/fmtlib/fmt/pull/168): | |
| 4931 | |
| 4932 ```c++ | |
| 4933 fmt::format("{0:{1}}", 42, 5); // gives " 42" | |
| 4934 ``` | |
| 4935 | |
| 4936 Thanks @jamboree. | |
| 4937 | |
| 4938 - \[Breaking\] Enums are now formatted with an overloaded | |
| 4939 `std::ostream` insertion operator (`operator<<`) if available | |
| 4940 (https://github.com/fmtlib/fmt/issues/232). | |
| 4941 | |
| 4942 - \[Breaking\] Changed default `bool` format to textual, \"true\" or | |
| 4943 \"false\" (https://github.com/fmtlib/fmt/issues/170): | |
| 4944 | |
| 4945 ```c++ | |
| 4946 fmt::print("{}", true); // prints "true" | |
| 4947 ``` | |
| 4948 | |
| 4949 To print `bool` as a number use numeric format specifier such as | |
| 4950 `d`: | |
| 4951 | |
| 4952 ```c++ | |
| 4953 fmt::print("{:d}", true); // prints "1" | |
| 4954 ``` | |
| 4955 | |
| 4956 - `fmt::printf` and `fmt::sprintf` now support formatting of `bool` | |
| 4957 with the `%s` specifier giving textual output, \"true\" or \"false\" | |
| 4958 (https://github.com/fmtlib/fmt/pull/223): | |
| 4959 | |
| 4960 ```c++ | |
| 4961 fmt::printf("%s", true); // prints "true" | |
| 4962 ``` | |
| 4963 | |
| 4964 Thanks @LarsGullik. | |
| 4965 | |
| 4966 - \[Breaking\] `signed char` and `unsigned char` are now formatted as | |
| 4967 integers by default | |
| 4968 (https://github.com/fmtlib/fmt/pull/217). | |
| 4969 | |
| 4970 - \[Breaking\] Pointers to C strings can now be formatted with the `p` | |
| 4971 specifier (https://github.com/fmtlib/fmt/pull/223): | |
| 4972 | |
| 4973 ```c++ | |
| 4974 fmt::print("{:p}", "test"); // prints pointer value | |
| 4975 ``` | |
| 4976 | |
| 4977 Thanks @LarsGullik. | |
| 4978 | |
| 4979 - \[Breaking\] `fmt::printf` and `fmt::sprintf` now print null | |
| 4980 pointers as `(nil)` and null strings as `(null)` for consistency | |
| 4981 with glibc (https://github.com/fmtlib/fmt/pull/226). | |
| 4982 Thanks @LarsGullik. | |
| 4983 | |
| 4984 - \[Breaking\] `fmt::(s)printf` now supports formatting of objects of | |
| 4985 user-defined types that provide an overloaded `std::ostream` | |
| 4986 insertion operator (`operator<<`) | |
| 4987 (https://github.com/fmtlib/fmt/issues/201): | |
| 4988 | |
| 4989 ```c++ | |
| 4990 fmt::printf("The date is %s", Date(2012, 12, 9)); | |
| 4991 ``` | |
| 4992 | |
| 4993 - \[Breaking\] The `Buffer` template is now part of the public API and | |
| 4994 can be used to implement custom memory buffers | |
| 4995 (https://github.com/fmtlib/fmt/issues/140). Thanks @polyvertex. | |
| 4996 | |
| 4997 - \[Breaking\] Improved compatibility between `BasicStringRef` and | |
| 4998 [std::experimental::basic_string_view]( | |
| 4999 http://en.cppreference.com/w/cpp/experimental/basic_string_view) | |
| 5000 (https://github.com/fmtlib/fmt/issues/100, | |
| 5001 https://github.com/fmtlib/fmt/issues/159, | |
| 5002 https://github.com/fmtlib/fmt/issues/183): | |
| 5003 | |
| 5004 - Comparison operators now compare string content, not pointers | |
| 5005 - `BasicStringRef::c_str` replaced by `BasicStringRef::data` | |
| 5006 - `BasicStringRef` is no longer assumed to be null-terminated | |
| 5007 | |
| 5008 References to null-terminated strings are now represented by a new | |
| 5009 class, `BasicCStringRef`. | |
| 5010 | |
| 5011 - Dependency on pthreads introduced by Google Test is now optional | |
| 5012 (https://github.com/fmtlib/fmt/issues/185). | |
| 5013 | |
| 5014 - New CMake options `FMT_DOC`, `FMT_INSTALL` and `FMT_TEST` to control | |
| 5015 generation of `doc`, `install` and `test` targets respectively, on | |
| 5016 by default (https://github.com/fmtlib/fmt/issues/197, | |
| 5017 https://github.com/fmtlib/fmt/issues/198, | |
| 5018 https://github.com/fmtlib/fmt/issues/200). Thanks @maddinat0r. | |
| 5019 | |
| 5020 - `noexcept` is now used when compiling with MSVC2015 | |
| 5021 (https://github.com/fmtlib/fmt/pull/215). Thanks @dmkrepo. | |
| 5022 | |
| 5023 - Added an option to disable use of `windows.h` when | |
| 5024 `FMT_USE_WINDOWS_H` is defined as 0 before including `format.h` | |
| 5025 (https://github.com/fmtlib/fmt/issues/171). Thanks @alfps. | |
| 5026 | |
| 5027 - \[Breaking\] `windows.h` is now included with `NOMINMAX` unless | |
| 5028 `FMT_WIN_MINMAX` is defined. This is done to prevent breaking code | |
| 5029 using `std::min` and `std::max` and only affects the header-only | |
| 5030 configuration (https://github.com/fmtlib/fmt/issues/152, | |
| 5031 https://github.com/fmtlib/fmt/pull/153, | |
| 5032 https://github.com/fmtlib/fmt/pull/154). Thanks @DevO2012. | |
| 5033 | |
| 5034 - Improved support for custom character types | |
| 5035 (https://github.com/fmtlib/fmt/issues/171). Thanks @alfps. | |
| 5036 | |
| 5037 - Added an option to disable use of IOStreams when `FMT_USE_IOSTREAMS` | |
| 5038 is defined as 0 before including `format.h` | |
| 5039 (https://github.com/fmtlib/fmt/issues/205, | |
| 5040 https://github.com/fmtlib/fmt/pull/208). Thanks @JodiTheTigger. | |
| 5041 | |
| 5042 - Improved detection of `isnan`, `isinf` and `signbit`. | |
| 5043 | |
| 5044 ## Optimization | |
| 5045 | |
| 5046 - Made formatting of user-defined types more efficient with a custom | |
| 5047 stream buffer (https://github.com/fmtlib/fmt/issues/92, | |
| 5048 https://github.com/fmtlib/fmt/pull/230). Thanks @NotImplemented. | |
| 5049 - Further improved performance of `fmt::Writer` on integer formatting | |
| 5050 and fixed a minor regression. Now it is \~7% faster than | |
| 5051 `karma::generate` on Karma\'s benchmark | |
| 5052 (https://github.com/fmtlib/fmt/issues/186). | |
| 5053 - \[Breaking\] Reduced [compiled code | |
| 5054 size](https://github.com/fmtlib/fmt#compile-time-and-code-bloat) | |
| 5055 (https://github.com/fmtlib/fmt/issues/143, | |
| 5056 https://github.com/fmtlib/fmt/pull/149). | |
| 5057 | |
| 5058 ## Distribution | |
| 5059 | |
| 5060 - \[Breaking\] Headers are now installed in | |
| 5061 `${CMAKE_INSTALL_PREFIX}/include/cppformat` | |
| 5062 (https://github.com/fmtlib/fmt/issues/178). Thanks @jackyf. | |
| 5063 | |
| 5064 - \[Breaking\] Changed the library name from `format` to `cppformat` | |
| 5065 for consistency with the project name and to avoid potential | |
| 5066 conflicts (https://github.com/fmtlib/fmt/issues/178). | |
| 5067 Thanks @jackyf. | |
| 5068 | |
| 5069 - C++ Format is now available in [Debian](https://www.debian.org/) | |
| 5070 GNU/Linux | |
| 5071 ([stretch](https://packages.debian.org/source/stretch/cppformat), | |
| 5072 [sid](https://packages.debian.org/source/sid/cppformat)) and derived | |
| 5073 distributions such as | |
| 5074 [Ubuntu](https://launchpad.net/ubuntu/+source/cppformat) 15.10 and | |
| 5075 later (https://github.com/fmtlib/fmt/issues/155): | |
| 5076 | |
| 5077 $ sudo apt-get install libcppformat1-dev | |
| 5078 | |
| 5079 Thanks @jackyf. | |
| 5080 | |
| 5081 - [Packages for Fedora and | |
| 5082 RHEL](https://admin.fedoraproject.org/pkgdb/package/cppformat/) are | |
| 5083 now available. Thanks Dave Johansen. | |
| 5084 | |
| 5085 - C++ Format can now be installed via [Homebrew](http://brew.sh/) on | |
| 5086 OS X (https://github.com/fmtlib/fmt/issues/157): | |
| 5087 | |
| 5088 $ brew install cppformat | |
| 5089 | |
| 5090 Thanks @ortho and Anatoliy Bulukin. | |
| 5091 | |
| 5092 ## Documentation | |
| 5093 | |
| 5094 - Migrated from ReadTheDocs to GitHub Pages for better responsiveness | |
| 5095 and reliability (https://github.com/fmtlib/fmt/issues/128). | |
| 5096 New documentation address is <http://cppformat.github.io/>. | |
| 5097 - Added [Building thedocumentation]( | |
| 5098 https://fmt.dev/2.0.0/usage.html#building-the-documentation) | |
| 5099 section to the documentation. | |
| 5100 - Documentation build script is now compatible with Python 3 and newer | |
| 5101 pip versions. (https://github.com/fmtlib/fmt/pull/189, | |
| 5102 https://github.com/fmtlib/fmt/issues/209). | |
| 5103 Thanks @JodiTheTigger and @xentec. | |
| 5104 - Documentation fixes and improvements | |
| 5105 (https://github.com/fmtlib/fmt/issues/36, | |
| 5106 https://github.com/fmtlib/fmt/issues/75, | |
| 5107 https://github.com/fmtlib/fmt/issues/125, | |
| 5108 https://github.com/fmtlib/fmt/pull/160, | |
| 5109 https://github.com/fmtlib/fmt/pull/161, | |
| 5110 https://github.com/fmtlib/fmt/issues/162, | |
| 5111 https://github.com/fmtlib/fmt/issues/165, | |
| 5112 https://github.com/fmtlib/fmt/issues/210). | |
| 5113 Thanks @syohex. | |
| 5114 - Fixed out-of-tree documentation build | |
| 5115 (https://github.com/fmtlib/fmt/issues/177). Thanks @jackyf. | |
| 5116 | |
| 5117 ## Fixes | |
| 5118 | |
| 5119 - Fixed `initializer_list` detection | |
| 5120 (https://github.com/fmtlib/fmt/issues/136). Thanks @Gachapen. | |
| 5121 | |
| 5122 - \[Breaking\] Fixed formatting of enums with numeric format | |
| 5123 specifiers in `fmt::(s)printf` | |
| 5124 (https://github.com/fmtlib/fmt/issues/131, | |
| 5125 https://github.com/fmtlib/fmt/issues/139): | |
| 5126 | |
| 5127 ```c++ | |
| 5128 enum { ANSWER = 42 }; | |
| 5129 fmt::printf("%d", ANSWER); | |
| 5130 ``` | |
| 5131 | |
| 5132 Thanks @Naios. | |
| 5133 | |
| 5134 - Improved compatibility with old versions of MinGW | |
| 5135 (https://github.com/fmtlib/fmt/issues/129, | |
| 5136 https://github.com/fmtlib/fmt/pull/130, | |
| 5137 https://github.com/fmtlib/fmt/issues/132). Thanks @cstamford. | |
| 5138 | |
| 5139 - Fixed a compile error on MSVC with disabled exceptions | |
| 5140 (https://github.com/fmtlib/fmt/issues/144). | |
| 5141 | |
| 5142 - Added a workaround for broken implementation of variadic templates | |
| 5143 in MSVC2012 (https://github.com/fmtlib/fmt/issues/148). | |
| 5144 | |
| 5145 - Placed the anonymous namespace within `fmt` namespace for the | |
| 5146 header-only configuration (https://github.com/fmtlib/fmt/issues/171). | |
| 5147 Thanks @alfps. | |
| 5148 | |
| 5149 - Fixed issues reported by Coverity Scan | |
| 5150 (https://github.com/fmtlib/fmt/issues/187, | |
| 5151 https://github.com/fmtlib/fmt/issues/192). | |
| 5152 | |
| 5153 - Implemented a workaround for a name lookup bug in MSVC2010 | |
| 5154 (https://github.com/fmtlib/fmt/issues/188). | |
| 5155 | |
| 5156 - Fixed compiler warnings | |
| 5157 (https://github.com/fmtlib/fmt/issues/95, | |
| 5158 https://github.com/fmtlib/fmt/issues/96, | |
| 5159 https://github.com/fmtlib/fmt/pull/114, | |
| 5160 https://github.com/fmtlib/fmt/issues/135, | |
| 5161 https://github.com/fmtlib/fmt/issues/142, | |
| 5162 https://github.com/fmtlib/fmt/issues/145, | |
| 5163 https://github.com/fmtlib/fmt/issues/146, | |
| 5164 https://github.com/fmtlib/fmt/issues/158, | |
| 5165 https://github.com/fmtlib/fmt/issues/163, | |
| 5166 https://github.com/fmtlib/fmt/issues/175, | |
| 5167 https://github.com/fmtlib/fmt/issues/190, | |
| 5168 https://github.com/fmtlib/fmt/pull/191, | |
| 5169 https://github.com/fmtlib/fmt/issues/194, | |
| 5170 https://github.com/fmtlib/fmt/pull/196, | |
| 5171 https://github.com/fmtlib/fmt/issues/216, | |
| 5172 https://github.com/fmtlib/fmt/pull/218, | |
| 5173 https://github.com/fmtlib/fmt/pull/220, | |
| 5174 https://github.com/fmtlib/fmt/pull/229, | |
| 5175 https://github.com/fmtlib/fmt/issues/233, | |
| 5176 https://github.com/fmtlib/fmt/issues/234, | |
| 5177 https://github.com/fmtlib/fmt/pull/236, | |
| 5178 https://github.com/fmtlib/fmt/issues/281, | |
| 5179 https://github.com/fmtlib/fmt/issues/289). | |
| 5180 Thanks @seanmiddleditch, @dixlorenz, @CarterLi, @Naios, @fmatthew5876, | |
| 5181 @LevskiWeng, @rpopescu, @gabime, @cubicool, @jkflying, @LogicalKnight, | |
| 5182 @inguin and @Jopie64. | |
| 5183 | |
| 5184 - Fixed portability issues (mostly causing test failures) on ARM, | |
| 5185 ppc64, ppc64le, s390x and SunOS 5.11 i386 | |
| 5186 (https://github.com/fmtlib/fmt/issues/138, | |
| 5187 https://github.com/fmtlib/fmt/issues/179, | |
| 5188 https://github.com/fmtlib/fmt/issues/180, | |
| 5189 https://github.com/fmtlib/fmt/issues/202, | |
| 5190 https://github.com/fmtlib/fmt/issues/225, [Red Hat Bugzilla | |
| 5191 Bug 1260297](https://bugzilla.redhat.com/show_bug.cgi?id=1260297)). | |
| 5192 Thanks @Naios, @jackyf and Dave Johansen. | |
| 5193 | |
| 5194 - Fixed a name conflict with macro `free` defined in `crtdbg.h` when | |
| 5195 `_CRTDBG_MAP_ALLOC` is set (https://github.com/fmtlib/fmt/issues/211). | |
| 5196 | |
| 5197 - Fixed shared library build on OS X | |
| 5198 (https://github.com/fmtlib/fmt/pull/212). Thanks @dean0x7d. | |
| 5199 | |
| 5200 - Fixed an overload conflict on MSVC when `/Zc:wchar_t-` option is | |
| 5201 specified (https://github.com/fmtlib/fmt/pull/214). | |
| 5202 Thanks @slavanap. | |
| 5203 | |
| 5204 - Improved compatibility with MSVC 2008 | |
| 5205 (https://github.com/fmtlib/fmt/pull/236). Thanks @Jopie64. | |
| 5206 | |
| 5207 - Improved compatibility with bcc32 | |
| 5208 (https://github.com/fmtlib/fmt/issues/227). | |
| 5209 | |
| 5210 - Fixed `static_assert` detection on Clang | |
| 5211 (https://github.com/fmtlib/fmt/pull/228). Thanks @dean0x7d. | |
| 5212 | |
| 5213 # 1.1.0 - 2015-03-06 | |
| 5214 | |
| 5215 - Added `BasicArrayWriter`, a class template that provides operations | |
| 5216 for formatting and writing data into a fixed-size array | |
| 5217 (https://github.com/fmtlib/fmt/issues/105 and | |
| 5218 https://github.com/fmtlib/fmt/issues/122): | |
| 5219 | |
| 5220 ```c++ | |
| 5221 char buffer[100]; | |
| 5222 fmt::ArrayWriter w(buffer); | |
| 5223 w.write("The answer is {}", 42); | |
| 5224 ``` | |
| 5225 | |
| 5226 - Added [0 A.D.](http://play0ad.com/) and [PenUltima Online | |
| 5227 (POL)](http://www.polserver.com/) to the list of notable projects | |
| 5228 using C++ Format. | |
| 5229 | |
| 5230 - C++ Format now uses MSVC intrinsics for better formatting performance | |
| 5231 (https://github.com/fmtlib/fmt/pull/115, | |
| 5232 https://github.com/fmtlib/fmt/pull/116, | |
| 5233 https://github.com/fmtlib/fmt/pull/118 and | |
| 5234 https://github.com/fmtlib/fmt/pull/121). Previously these | |
| 5235 optimizations where only used on GCC and Clang. | |
| 5236 Thanks @CarterLi and @objectx. | |
| 5237 | |
| 5238 - CMake install target | |
| 5239 (https://github.com/fmtlib/fmt/pull/119). Thanks @TrentHouliston. | |
| 5240 | |
| 5241 You can now install C++ Format with `make install` command. | |
| 5242 | |
| 5243 - Improved [Biicode](http://www.biicode.com/) support | |
| 5244 (https://github.com/fmtlib/fmt/pull/98 and | |
| 5245 https://github.com/fmtlib/fmt/pull/104). | |
| 5246 Thanks @MariadeAnton and @franramirez688. | |
| 5247 | |
| 5248 - Improved support for building with [Android NDK]( | |
| 5249 https://developer.android.com/tools/sdk/ndk/index.html) | |
| 5250 (https://github.com/fmtlib/fmt/pull/107). Thanks @newnon. | |
| 5251 | |
| 5252 The [android-ndk-example](https://github.com/fmtlib/android-ndk-example) | |
| 5253 repository provides and example of using C++ Format with Android NDK: | |
| 5254 | |
| 5255  | |
| 5256 | |
| 5257 - Improved documentation of `SystemError` and `WindowsError` | |
| 5258 (https://github.com/fmtlib/fmt/issues/54). | |
| 5259 | |
| 5260 - Various code improvements | |
| 5261 (https://github.com/fmtlib/fmt/pull/110, | |
| 5262 https://github.com/fmtlib/fmt/pull/111 | |
| 5263 https://github.com/fmtlib/fmt/pull/112). Thanks @CarterLi. | |
| 5264 | |
| 5265 - Improved compile-time errors when formatting wide into narrow | |
| 5266 strings (https://github.com/fmtlib/fmt/issues/117). | |
| 5267 | |
| 5268 - Fixed `BasicWriter::write` without formatting arguments when C++11 | |
| 5269 support is disabled | |
| 5270 (https://github.com/fmtlib/fmt/issues/109). | |
| 5271 | |
| 5272 - Fixed header-only build on OS X with GCC 4.9 | |
| 5273 (https://github.com/fmtlib/fmt/issues/124). | |
| 5274 | |
| 5275 - Fixed packaging issues (https://github.com/fmtlib/fmt/issues/94). | |
| 5276 | |
| 5277 - Added [changelog](https://github.com/fmtlib/fmt/blob/master/ChangeLog.md) | |
| 5278 (https://github.com/fmtlib/fmt/issues/103). | |
| 5279 | |
| 5280 # 1.0.0 - 2015-02-05 | |
| 5281 | |
| 5282 - Add support for a header-only configuration when `FMT_HEADER_ONLY` | |
| 5283 is defined before including `format.h`: | |
| 5284 | |
| 5285 ```c++ | |
| 5286 #define FMT_HEADER_ONLY | |
| 5287 #include "format.h" | |
| 5288 ``` | |
| 5289 | |
| 5290 - Compute string length in the constructor of `BasicStringRef` instead | |
| 5291 of the `size` method | |
| 5292 (https://github.com/fmtlib/fmt/issues/79). This eliminates | |
| 5293 size computation for string literals on reasonable optimizing | |
| 5294 compilers. | |
| 5295 | |
| 5296 - Fix formatting of types with overloaded `operator <<` for | |
| 5297 `std::wostream` (https://github.com/fmtlib/fmt/issues/86): | |
| 5298 | |
| 5299 ```c++ | |
| 5300 fmt::format(L"The date is {0}", Date(2012, 12, 9)); | |
| 5301 ``` | |
| 5302 | |
| 5303 - Fix linkage of tests on Arch Linux | |
| 5304 (https://github.com/fmtlib/fmt/issues/89). | |
| 5305 | |
| 5306 - Allow precision specifier for non-float arguments | |
| 5307 (https://github.com/fmtlib/fmt/issues/90): | |
| 5308 | |
| 5309 ```c++ | |
| 5310 fmt::print("{:.3}\n", "Carpet"); // prints "Car" | |
| 5311 ``` | |
| 5312 | |
| 5313 - Fix build on Android NDK (https://github.com/fmtlib/fmt/issues/93). | |
| 5314 | |
| 5315 - Improvements to documentation build procedure. | |
| 5316 | |
| 5317 - Remove `FMT_SHARED` CMake variable in favor of standard [BUILD_SHARED_LIBS]( | |
| 5318 http://www.cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html). | |
| 5319 | |
| 5320 - Fix error handling in `fmt::fprintf`. | |
| 5321 | |
| 5322 - Fix a number of warnings. | |
| 5323 | |
| 5324 # 0.12.0 - 2014-10-25 | |
| 5325 | |
| 5326 - \[Breaking\] Improved separation between formatting and buffer | |
| 5327 management. `Writer` is now a base class that cannot be instantiated | |
| 5328 directly. The new `MemoryWriter` class implements the default buffer | |
| 5329 management with small allocations done on stack. So `fmt::Writer` | |
| 5330 should be replaced with `fmt::MemoryWriter` in variable | |
| 5331 declarations. | |
| 5332 | |
| 5333 Old code: | |
| 5334 | |
| 5335 ```c++ | |
| 5336 fmt::Writer w; | |
| 5337 ``` | |
| 5338 | |
| 5339 New code: | |
| 5340 | |
| 5341 ```c++ | |
| 5342 fmt::MemoryWriter w; | |
| 5343 ``` | |
| 5344 | |
| 5345 If you pass `fmt::Writer` by reference, you can continue to do so: | |
| 5346 | |
| 5347 ```c++ | |
| 5348 void f(fmt::Writer &w); | |
| 5349 ``` | |
| 5350 | |
| 5351 This doesn\'t affect the formatting API. | |
| 5352 | |
| 5353 - Support for custom memory allocators | |
| 5354 (https://github.com/fmtlib/fmt/issues/69) | |
| 5355 | |
| 5356 - Formatting functions now accept [signed char]{.title-ref} and | |
| 5357 [unsigned char]{.title-ref} strings as arguments | |
| 5358 (https://github.com/fmtlib/fmt/issues/73): | |
| 5359 | |
| 5360 ```c++ | |
| 5361 auto s = format("GLSL version: {}", glGetString(GL_VERSION)); | |
| 5362 ``` | |
| 5363 | |
| 5364 - Reduced code bloat. According to the new [benchmark | |
| 5365 results](https://github.com/fmtlib/fmt#compile-time-and-code-bloat), | |
| 5366 cppformat is close to `printf` and by the order of magnitude better | |
| 5367 than Boost Format in terms of compiled code size. | |
| 5368 | |
| 5369 - Improved appearance of the documentation on mobile by using the | |
| 5370 [Sphinx Bootstrap | |
| 5371 theme](http://ryan-roemer.github.io/sphinx-bootstrap-theme/): | |
| 5372 | |
| 5373 | Old | New | | |
| 5374 | --- | --- | | |
| 5375 |  |  | | |
| 5376 | |
| 5377 # 0.11.0 - 2014-08-21 | |
| 5378 | |
| 5379 - Safe printf implementation with a POSIX extension for positional | |
| 5380 arguments: | |
| 5381 | |
| 5382 ```c++ | |
| 5383 fmt::printf("Elapsed time: %.2f seconds", 1.23); | |
| 5384 fmt::printf("%1$s, %3$d %2$s", weekday, month, day); | |
| 5385 ``` | |
| 5386 | |
| 5387 - Arguments of `char` type can now be formatted as integers (Issue | |
| 5388 https://github.com/fmtlib/fmt/issues/55): | |
| 5389 | |
| 5390 ```c++ | |
| 5391 fmt::format("0x{0:02X}", 'a'); | |
| 5392 ``` | |
| 5393 | |
| 5394 - Deprecated parts of the API removed. | |
| 5395 | |
| 5396 - The library is now built and tested on MinGW with Appveyor in | |
| 5397 addition to existing test platforms Linux/GCC, OS X/Clang, | |
| 5398 Windows/MSVC. | |
| 5399 | |
| 5400 # 0.10.0 - 2014-07-01 | |
| 5401 | |
| 5402 **Improved API** | |
| 5403 | |
| 5404 - All formatting methods are now implemented as variadic functions | |
| 5405 instead of using `operator<<` for feeding arbitrary arguments into a | |
| 5406 temporary formatter object. This works both with C++11 where | |
| 5407 variadic templates are used and with older standards where variadic | |
| 5408 functions are emulated by providing lightweight wrapper functions | |
| 5409 defined with the `FMT_VARIADIC` macro. You can use this macro for | |
| 5410 defining your own portable variadic functions: | |
| 5411 | |
| 5412 ```c++ | |
| 5413 void report_error(const char *format, const fmt::ArgList &args) { | |
| 5414 fmt::print("Error: {}"); | |
| 5415 fmt::print(format, args); | |
| 5416 } | |
| 5417 FMT_VARIADIC(void, report_error, const char *) | |
| 5418 | |
| 5419 report_error("file not found: {}", path); | |
| 5420 ``` | |
| 5421 | |
| 5422 Apart from a more natural syntax, this also improves performance as | |
| 5423 there is no need to construct temporary formatter objects and | |
| 5424 control arguments\' lifetimes. Because the wrapper functions are | |
| 5425 very lightweight, this doesn\'t cause code bloat even in pre-C++11 | |
| 5426 mode. | |
| 5427 | |
| 5428 - Simplified common case of formatting an `std::string`. Now it | |
| 5429 requires a single function call: | |
| 5430 | |
| 5431 ```c++ | |
| 5432 std::string s = format("The answer is {}.", 42); | |
| 5433 ``` | |
| 5434 | |
| 5435 Previously it required 2 function calls: | |
| 5436 | |
| 5437 ```c++ | |
| 5438 std::string s = str(Format("The answer is {}.") << 42); | |
| 5439 ``` | |
| 5440 | |
| 5441 Instead of unsafe `c_str` function, `fmt::Writer` should be used | |
| 5442 directly to bypass creation of `std::string`: | |
| 5443 | |
| 5444 ```c++ | |
| 5445 fmt::Writer w; | |
| 5446 w.write("The answer is {}.", 42); | |
| 5447 w.c_str(); // returns a C string | |
| 5448 ``` | |
| 5449 | |
| 5450 This doesn\'t do dynamic memory allocation for small strings and is | |
| 5451 less error prone as the lifetime of the string is the same as for | |
| 5452 `std::string::c_str` which is well understood (hopefully). | |
| 5453 | |
| 5454 - Improved consistency in naming functions that are a part of the | |
| 5455 public API. Now all public functions are lowercase following the | |
| 5456 standard library conventions. Previously it was a combination of | |
| 5457 lowercase and CapitalizedWords. Issue | |
| 5458 https://github.com/fmtlib/fmt/issues/50. | |
| 5459 | |
| 5460 - Old functions are marked as deprecated and will be removed in the | |
| 5461 next release. | |
| 5462 | |
| 5463 **Other Changes** | |
| 5464 | |
| 5465 - Experimental support for printf format specifications (work in | |
| 5466 progress): | |
| 5467 | |
| 5468 ```c++ | |
| 5469 fmt::printf("The answer is %d.", 42); | |
| 5470 std::string s = fmt::sprintf("Look, a %s!", "string"); | |
| 5471 ``` | |
| 5472 | |
| 5473 - Support for hexadecimal floating point format specifiers `a` and | |
| 5474 `A`: | |
| 5475 | |
| 5476 ```c++ | |
| 5477 print("{:a}", -42.0); // Prints -0x1.5p+5 | |
| 5478 print("{:A}", -42.0); // Prints -0X1.5P+5 | |
| 5479 ``` | |
| 5480 | |
| 5481 - CMake option `FMT_SHARED` that specifies whether to build format as | |
| 5482 a shared library (off by default). | |
| 5483 | |
| 5484 # 0.9.0 - 2014-05-13 | |
| 5485 | |
| 5486 - More efficient implementation of variadic formatting functions. | |
| 5487 | |
| 5488 - `Writer::Format` now has a variadic overload: | |
| 5489 | |
| 5490 ```c++ | |
| 5491 Writer out; | |
| 5492 out.Format("Look, I'm {}!", "variadic"); | |
| 5493 ``` | |
| 5494 | |
| 5495 - For efficiency and consistency with other overloads, variadic | |
| 5496 overload of the `Format` function now returns `Writer` instead of | |
| 5497 `std::string`. Use the `str` function to convert it to | |
| 5498 `std::string`: | |
| 5499 | |
| 5500 ```c++ | |
| 5501 std::string s = str(Format("Look, I'm {}!", "variadic")); | |
| 5502 ``` | |
| 5503 | |
| 5504 - Replaced formatter actions with output sinks: `NoAction` -\> | |
| 5505 `NullSink`, `Write` -\> `FileSink`, `ColorWriter` -\> | |
| 5506 `ANSITerminalSink`. This improves naming consistency and shouldn\'t | |
| 5507 affect client code unless these classes are used directly which | |
| 5508 should be rarely needed. | |
| 5509 | |
| 5510 - Added `ThrowSystemError` function that formats a message and throws | |
| 5511 `SystemError` containing the formatted message and system-specific | |
| 5512 error description. For example, the following code | |
| 5513 | |
| 5514 ```c++ | |
| 5515 FILE *f = fopen(filename, "r"); | |
| 5516 if (!f) | |
| 5517 ThrowSystemError(errno, "Failed to open file '{}'") << filename; | |
| 5518 ``` | |
| 5519 | |
| 5520 will throw `SystemError` exception with description \"Failed to open | |
| 5521 file \'\<filename\>\': No such file or directory\" if file doesn\'t | |
| 5522 exist. | |
| 5523 | |
| 5524 - Support for AppVeyor continuous integration platform. | |
| 5525 | |
| 5526 - `Format` now throws `SystemError` in case of I/O errors. | |
| 5527 | |
| 5528 - Improve test infrastructure. Print functions are now tested by | |
| 5529 redirecting the output to a pipe. | |
| 5530 | |
| 5531 # 0.8.0 - 2014-04-14 | |
| 5532 | |
| 5533 - Initial release |
