Skip to content

Commit f3c594a

Browse files
authored
Merge pull request #1166 from cppalliance/wide
Add wider character support for {fmt} formatting
2 parents ad72687 + 717d4d0 commit f3c594a

File tree

4 files changed

+291
-22
lines changed

4 files changed

+291
-22
lines changed

doc/modules/ROOT/pages/format.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ For example with `{:10.3e}`:
7070

7171
Note the space at the front of these string to keep with width at 10 characters
7272

73+
=== String Literal Support
74+
75+
If you want the result to be a different string width than `char` you can specify this with the format string.
76+
For example if you want the result to be `wchar_t` you can use `L"{}"`.
77+
`wchar_t`, `char16_t`, `char32_t` are supported from pass:[C++17].
78+
`char8_t` is supported from pass:[C++20].
79+
7380
=== Putting it All Together
7481

7582
The appropriate order for the full format specifier is:
7683

77-
Locale, Sign, Padding, Precision, Type
84+
String literal pass:["{Locale, Sign, Padding, Precision, Type}"]
7885

7986
=== Examples
8087

include/boost/decimal/detail/config.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,8 @@ static_assert(std::is_same<long double, __float128>::value, "__float128 should b
412412

413413
#endif
414414

415+
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
416+
# define BOOST_DECIMAL_HAS_CHAR8_T
417+
#endif
418+
415419
#endif // BOOST_DECIMAL_DETAIL_CONFIG_HPP

0 commit comments

Comments
 (0)