Skip to content

Commit f2fd9c7

Browse files
authored
Merge branch 'fmtlib:master' into zig-pkg
2 parents 5a9f98c + 2c991e1 commit f2fd9c7

File tree

2 files changed

+128
-12
lines changed

2 files changed

+128
-12
lines changed

ChangeLog.rst

Lines changed: 126 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,29 @@
1717

1818
Thanks `@jk-jeon (Junekey Jeon) <https://github.com/jk-jeon>`_.
1919

20+
* Replaced ``snprintf``-based hex float formatter with an internal
21+
implementation (`#3179 <https://github.com/fmtlib/fmt/pull/3179>`_,
22+
`#3203 <https://github.com/fmtlib/fmt/pull/3203>`_).
23+
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.
24+
2025
* Fixed alignment of floating-point numbers with localization
2126
(`#3263 <https://github.com/fmtlib/fmt/issues/3263>`_,
2227
`#3272 <https://github.com/fmtlib/fmt/pull/3272>`_).
2328
Thanks `@ShawnZhong (Shawn Zhong) <https://github.com/ShawnZhong>`_.
2429

2530
* Improved C++20 module support
26-
(`#3386 <https://github.com/fmtlib/fmt/pull/3386>`_,
31+
(`#3134 <https://github.com/fmtlib/fmt/pull/3134>`_,
32+
`#3254 <https://github.com/fmtlib/fmt/pull/3254>`_,
33+
`#3386 <https://github.com/fmtlib/fmt/pull/3386>`_,
2734
`#3387 <https://github.com/fmtlib/fmt/pull/3387>`_,
2835
`#3388 <https://github.com/fmtlib/fmt/pull/3388>`_,
2936
`#3392 <https://github.com/fmtlib/fmt/pull/3392>`_,
3037
`#3397 <https://github.com/fmtlib/fmt/pull/3397>`_,
3138
`#3399 <https://github.com/fmtlib/fmt/pull/3399>`_,
3239
`#3400 <https://github.com/fmtlib/fmt/pull/3400>`_).
33-
Thanks `@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
40+
Thanks `@laitingsheng (Tinson Lai) <https://github.com/laitingsheng>`_,
41+
`@Orvid (Orvid King) <https://github.com/Orvid>`_,
42+
`@DanielaE (Daniela Engert) <https://github.com/DanielaE>`_.
3443
Switched to the `modules CMake library <https://github.com/vitaut/modules>`_
3544
which allows building {fmt} as a C++20 module with clang::
3645

@@ -78,6 +87,8 @@
7887
(`#2207 <https://github.com/fmtlib/fmt/issues/2207>`_,
7988
`#3117 <https://github.com/fmtlib/fmt/issues/3117>`_,
8089
`#3115 <https://github.com/fmtlib/fmt/pull/3115>`_,
90+
`#3143 <https://github.com/fmtlib/fmt/pull/3143>`_,
91+
`#3144 <https://github.com/fmtlib/fmt/pull/3144>`_,
8192
`#3349 <https://github.com/fmtlib/fmt/pull/3349>`_).
8293
For example (`godbolt <https://godbolt.org/z/45738oGEo>`__):
8394

@@ -91,7 +102,12 @@
91102
}
92103

93104
Thanks `@patrickroocks (Patrick Roocks) <https://github.com/patrickroocks>`_
94-
and `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
105+
`@phprus (Vladislav Shchapov) <https://github.com/phprus>`_,
106+
`@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
107+
108+
* Add precision support to ``%S``
109+
(`#3148 <https://github.com/fmtlib/fmt/pull/3148>`_).
110+
Thanks `@SappyJoy (Stepan Ponomaryov) <https://github.com/SappyJoy>`_
95111

96112
* Added support for ``std::utc_time``
97113
(`#3098 <https://github.com/fmtlib/fmt/issues/3098>`_,
@@ -114,6 +130,39 @@
114130
`#3232 <https://github.com/fmtlib/fmt/pull/3232>`_).
115131
Thanks `@ShawnZhong (Shawn Zhong) <https://github.com/ShawnZhong>`_.
116132

133+
* Added a formatter for ``std::exception``
134+
(`#2977 <https://github.com/fmtlib/fmt/issues/2977>`_,
135+
`#3012 <https://github.com/fmtlib/fmt/issues/3012>`_,
136+
`#3062 <https://github.com/fmtlib/fmt/pull/3062>`_,
137+
`#3076 <https://github.com/fmtlib/fmt/pull/3076>`_,
138+
`#3119 <https://github.com/fmtlib/fmt/pull/3119>`_).
139+
For example (`godbolt <https://godbolt.org/z/8xoWGs9e4>`__):
140+
141+
.. code:: c++
142+
143+
#include <fmt/std.h>
144+
#include <vector>
145+
146+
int main() {
147+
try {
148+
std::vector<bool>().at(0);
149+
} catch(const std::exception& e) {
150+
fmt::print("{}", e);
151+
}
152+
}
153+
154+
prints::
155+
156+
vector<bool>::_M_range_check: __n (which is 0) >= this->size() (which is 0)
157+
158+
on libstdc++.
159+
Thanks `@zach2good (Zach Toogood) <https://github.com/zach2good>`_ and
160+
`@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.
161+
162+
* Moved ``std::error_code`` formatter from ``fmt/os.h`` to ``fmt/std.h``.
163+
(`#3125 <https://github.com/fmtlib/fmt/pull/3125>`_).
164+
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.
165+
117166
* Added formatters for standard container adapters: ``std::priority_queue``,
118167
``std::queue`` and ``std::stack``
119168
(`#3215 <https://github.com/fmtlib/fmt/issues/3215>`_,
@@ -138,8 +187,13 @@
138187
(`#3347 <https://github.com/fmtlib/fmt/pull/3347>`_).
139188
Thanks `@TheOmegaCarrot <https://github.com/TheOmegaCarrot>`_.
140189

141-
* Fixed formatting of noncopyable ranges
142-
(`#3286 <https://github.com/fmtlib/fmt/issues/3286>`_,
190+
* Made ``fmt::ptr`` accept ``unique_ptr`` with a custom deleter
191+
(`#3177 <https://github.com/fmtlib/fmt/pull/3177>`_).
192+
Thanks `@hmbj (Hans-Martin B. Jensen) <https://github.com/hmbj>`_.
193+
194+
* Fixed formatting of noncopyable ranges and nested ranges of chars
195+
(`#3158 <https://github.com/fmtlib/fmt/pull/3158>`_
196+
`#3286 <https://github.com/fmtlib/fmt/issues/3286>`_,
143197
`#3290 <https://github.com/fmtlib/fmt/pull/3290>`_).
144198
Thanks `@BRevzin (Barry Revzin) <https://github.com/BRevzin>`_.
145199

@@ -187,6 +241,23 @@
187241
(`#3416 <https://github.com/fmtlib/fmt/pull/3416>`_).
188242
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.
189243

244+
* Added support for UTF-8 digit separators via an experimental locale facet
245+
(`#1861 <https://github.com/fmtlib/fmt/issues/1861>`_).
246+
For example (`godbolt <https://godbolt.org/z/f7bcznb3W>`__):
247+
248+
.. code:: c++
249+
250+
auto loc = std::locale(
251+
std::locale(), new fmt::format_facet<std::locale>("’"));
252+
auto s = fmt::format(loc, "{:L}", 1000);
253+
254+
where ```` is U+2019 used as a digit separator in the de_CH locale.
255+
256+
* Added an overload of ``formatted_size`` that takes a locale
257+
(`#3084 <https://github.com/fmtlib/fmt/issues/3084>`_,
258+
`#3087 <https://github.com/fmtlib/fmt/pull/3087>`_).
259+
Thanks `@gerboengels <https://github.com/gerboengels>`_.
260+
190261
* Removed the deprecated ``FMT_DEPRECATED_OSTREAM``.
191262

192263
* Fixed a UB when using a null ``std::string_view`` with ``fmt::to_string``
@@ -195,14 +266,32 @@
195266
`#3244 <https://github.com/fmtlib/fmt/pull/3244>`_).
196267
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.
197268

269+
* Added ``starts_with`` to the fallback ``string_view`` implementation
270+
(`#3080 <https://github.com/fmtlib/fmt/pull/3080>`_).
271+
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_.
272+
273+
* Added ``fmt::basic_format_string::get()`` for compatibility with
274+
``basic_format_string`` (`#3111 <https://github.com/fmtlib/fmt/pull/3111>`_).
275+
Thanks `@huangqinjin <https://github.com/huangqinjin>`_.
276+
198277
* Improved documentation
199278
(`#3108 <https://github.com/fmtlib/fmt/issues/3108>`_,
200279
`#3169 <https://github.com/fmtlib/fmt/issues/3169>`_,
280+
`#3243 <https://github.com/fmtlib/fmt/pull/3243>`_).
201281
`#3404 <https://github.com/fmtlib/fmt/pull/3404>`_).
202-
Thanks `@Vertexwahn <https://github.com/Vertexwahn>`_.
282+
Thanks `@Cleroth <https://github.com/Cleroth>`_ and
283+
`@Vertexwahn <https://github.com/Vertexwahn>`_.
203284

204285
* Improved build configuration and tests
205-
(`#3189 <https://github.com/fmtlib/fmt/issues/3189>`_,
286+
(`#3118 <https://github.com/fmtlib/fmt/pull/3118>`_,
287+
`#3120 <https://github.com/fmtlib/fmt/pull/3120>`_,
288+
`#3188 <https://github.com/fmtlib/fmt/pull/3188>`_,
289+
`#3189 <https://github.com/fmtlib/fmt/issues/3189>`_,
290+
`#3198 <https://github.com/fmtlib/fmt/pull/3198>`_,
291+
`#3205 <https://github.com/fmtlib/fmt/pull/3205>`_,
292+
`#3207 <https://github.com/fmtlib/fmt/pull/3207>`_,
293+
`#3210 <https://github.com/fmtlib/fmt/pull/3210>`_,
294+
`#3240 <https://github.com/fmtlib/fmt/pull/3240>`_,
206295
`#3299 <https://github.com/fmtlib/fmt/issues/3299>`_,
207296
`#3302 <https://github.com/fmtlib/fmt/pull/3302>`_,
208297
`#3317 <https://github.com/fmtlib/fmt/issues/3317>`_,
@@ -211,7 +300,10 @@
211300
`#3395 <https://github.com/fmtlib/fmt/pull/3395>`_,
212301
`#3406 <https://github.com/fmtlib/fmt/pull/3406>`_,
213302
`#3411 <https://github.com/fmtlib/fmt/pull/3411>`_).
214-
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_,
303+
Thanks `@dimztimz (Dimitrij Mijoski) <https://github.com/dimztimz>`_,
304+
`@phprus (Vladislav Shchapov) <https://github.com/phprus>`_,
305+
`@DavidKorczynski <https://github.com/DavidKorczynski>`_,
306+
`@ChrisThrasher (Chris Thrasher) <https://github.com/ChrisThrasher>`_,
215307
`@joycebrum (Joyce) <https://github.com/joycebrum>`_,
216308
`@kevinhwang (Kevin Hwang) <https://github.com/kevinhwang>`_,
217309
`@Vertexwahn <https://github.com/Vertexwahn>`_.
@@ -230,17 +322,34 @@
230322
(`#3068 <https://github.com/fmtlib/fmt/pull/3068>`_).
231323

232324
* Fixed various warnings and compilation issues
233-
(`#3092 <https://github.com/fmtlib/fmt/issues/3092>`_,
325+
(`#3057 <https://github.com/fmtlib/fmt/pull/3057>`_,
326+
`#3066 <https://github.com/fmtlib/fmt/pull/3066>`_,
327+
`#3072 <https://github.com/fmtlib/fmt/pull/3072>`_,
328+
`#3082 <https://github.com/fmtlib/fmt/pull/3082>`_,
329+
`#3091 <https://github.com/fmtlib/fmt/pull/3091>`_,
330+
`#3092 <https://github.com/fmtlib/fmt/issues/3092>`_,
331+
`#3093 <https://github.com/fmtlib/fmt/pull/3093>`_,
332+
`#3095 <https://github.com/fmtlib/fmt/pull/3095>`_,
234333
`#3096 <https://github.com/fmtlib/fmt/issues/3096>`_,
334+
`#3097 <https://github.com/fmtlib/fmt/pull/3097>`_,
235335
`#3128 <https://github.com/fmtlib/fmt/issues/3128>`_,
336+
`#3129 <https://github.com/fmtlib/fmt/pull/3129>`_,
337+
`#3137 <https://github.com/fmtlib/fmt/pull/3137>`_,
338+
`#3139 <https://github.com/fmtlib/fmt/pull/3139>`_,
236339
`#3140 <https://github.com/fmtlib/fmt/issues/3140>`_,
340+
`#3142 <https://github.com/fmtlib/fmt/pull/3142>`_,
237341
`#3149 <https://github.com/fmtlib/fmt/issues/3149>`_,
342+
`#3150 <https://github.com/fmtlib/fmt/pull/3150>`_,
238343
`#3154 <https://github.com/fmtlib/fmt/issues/3154>`_,
239344
`#3163 <https://github.com/fmtlib/fmt/issues/3163>`_,
240345
`#3178 <https://github.com/fmtlib/fmt/issues/3178>`_,
346+
`#3184 <https://github.com/fmtlib/fmt/pull/3184>`_,
347+
`#3196 <https://github.com/fmtlib/fmt/pull/3196>`_,
241348
`#3204 <https://github.com/fmtlib/fmt/issues/3204>`_,
349+
`#3206 <https://github.com/fmtlib/fmt/pull/3206>`_,
242350
`#3208 <https://github.com/fmtlib/fmt/pull/3208>`_,
243351
`#3213 <https://github.com/fmtlib/fmt/issues/3213>`_,
352+
`#3216 <https://github.com/fmtlib/fmt/pull/3216>`_,
244353
`#3224 <https://github.com/fmtlib/fmt/issues/3224>`_,
245354
`#3226 <https://github.com/fmtlib/fmt/issues/3226>`_,
246355
`#3228 <https://github.com/fmtlib/fmt/issues/3228>`_,
@@ -268,7 +377,15 @@
268377
`#3413 <https://github.com/fmtlib/fmt/pull/3413>`_,
269378
`#3415 <https://github.com/fmtlib/fmt/issues/3415>`_).
270379
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_,
380+
`@gsjaardema (Greg Sjaardema) <https://github.com/gsjaardema>`_,
381+
`@NewbieOrange <https://github.com/NewbieOrange>`_,
382+
`@EngineLessCC (VivyaCC) <https://github.com/EngineLessCC>`_,
383+
`@asmaloney (Andy Maloney) <https://github.com/asmaloney>`_,
384+
`@HazardyKnusperkeks (Björn Schäpers)
385+
<https://github.com/HazardyKnusperkeks>`_,
271386
`@sergiud (Sergiu Deitsch) <https://github.com/sergiud>`_,
387+
`@Youw (Ihor Dutchak) <https://github.com/Youw>`_,
388+
`@thesmurph <https://github.com/thesmurph>`_,
272389
`@czudziakm (Maksymilian Czudziak) <https://github.com/czudziakm>`_,
273390
`@chronoxor (Ivan Shynkarenka) <https://github.com/chronoxor>`_,
274391
`@ShawnZhong (Shawn Zhong) <https://github.com/ShawnZhong>`_,

include/fmt/chrono.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,6 @@ class tm_writer {
13601360

13611361
OutputIt out() const { return out_; }
13621362

1363-
const std::locale& locale() const { return loc_; }
1364-
13651363
FMT_CONSTEXPR void on_text(const Char* begin, const Char* end) {
13661364
out_ = copy_str<Char>(begin, end, out_);
13671365
}
@@ -1640,7 +1638,8 @@ struct chrono_format_checker : null_chrono_spec_handler<chrono_format_checker> {
16401638
FMT_CONSTEXPR void on_duration_unit() {}
16411639
};
16421640

1643-
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value && has_isfinite<T>::value)>
1641+
template <typename T,
1642+
FMT_ENABLE_IF(std::is_integral<T>::value&& has_isfinite<T>::value)>
16441643
inline bool isfinite(T) {
16451644
return true;
16461645
}

0 commit comments

Comments
 (0)