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