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