egorkaa
cde18a38bb
Support width and alignment in std::exception formatter ( #4860 )
...
* Support width and alignment in std::exception formatter
The formatter for std::exception (and std::exception_ptr) previously
accepted only the optional 't' type-name specifier, so standard fill,
align and width specifiers were rejected with "unknown format
specifier". This made it impossible to pad or align exception messages,
e.g. when laying them out in a log column.
Parse the standard fill/align/width specifiers (as the std::filesystem::
path formatter already does) and apply them when writing the message.
Dynamic width ({:{}}) and the 'none'/'unknown exception' cases for
exception_ptr are handled too. Existing behavior ({}, {:t}, nested
exception unwinding) is unchanged.
* Update std.h
2026-08-13 11:00:46 -07:00
Victor Zverovich
b5d1e5404b
Annotate FMT_USE_RTTI #endif directives
...
Add trailing "// FMT_USE_RTTI" comments to the matching #endif lines to make
the conditional-compilation blocks easier to follow.
2026-07-17 12:12:25 -07:00
Avi Kivity
1a99c2630c
Format nested exceptions in std::exception formatter ( #4844 )
...
Detect when a std::exception also derives from std::nested_exception
(e.g. via std::throw_with_nested) and unwind the whole chain, joining
each level with ": ". The type-name flag ({:t}) is honored at every
level, and the std::exception_ptr formatter inherits this behavior.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 08:50:10 -07:00
Victor Zverovich
9d13c41ce6
Format null std::exception_ptr as "none"
...
Change the null exception_ptr representation from "nullptr" to "none" to
convey the "no exception" state more clearly, and update the test.
2026-07-11 08:21:32 -07:00
Jan
6dac6cad05
feat: add formatter for std::exception_ptr ( #4808 ) ( #4819 )
2026-07-05 09:22:18 -07:00
Victor Zverovich
46cf422f54
Unify copyright notices
2026-05-31 08:54:06 -07:00
Stéén
b35de87ad9
std.h: Allow formatting std::unexpected type. ( #4675 )
...
In some cases, people might want to format the std::unexpected type itself,
independent of the value type, this commit makes it possible.
Co-authored-by: Robin Oger <robin.oger.work@gmail.com>
2026-02-11 15:06:59 -08:00
Victor Zverovich
eb99f6eba6
Move std::byte formatter to std.h
2026-02-03 10:16:20 -08:00
Victor Zverovich
3f98b54bd7
Move _BitInt next to bitref formatter
2026-02-02 17:08:10 -08:00
Victor Zverovich
1122268510
Make path formatting lossless with WTF-8
2025-11-05 10:59:06 -10:00
Victor Zverovich
08d38d6e78
Make error_code formatter debug-enabled
2025-10-19 10:35:45 -07:00
Vladislav Shchapov
85f6ecc7a0
Add format_as support for std::variant and std::expected formatters ( #4575 )
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2025-10-18 14:05:21 -07:00
Oleksandr Koval
486e7ba579
support std::optional holding cv-qualified types ( #4562 )
...
Fixes #4561
2025-10-03 04:40:44 -07:00
Victor Zverovich
07885271a1
Minor cleanup
2025-05-11 07:54:23 -07:00
Jeremy Rifkin
4999416e5c
Fix reference_wrapper ambiguity with format_as ( #4434 )
2025-05-10 11:15:45 -07:00
Victor Zverovich
c936e2e44e
Implement debug format for error_code
2025-04-27 09:06:17 -07:00
Victor Zverovich
a7d7b894cd
Implement the s specifier for error_code
2025-04-27 08:51:18 -07:00
Victor Zverovich
191c504b10
Cleanup build config
2025-03-16 08:24:31 -07:00
timsong-cpp
f841ae61e2
Fix #4303 : avoid instantiating formatter<const T> ( #4325 )
2025-01-24 10:53:10 -08:00
Vladislav Shchapov
dad3237514
Fix a bug when copying the fill from basic_specs
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2025-01-03 09:16:21 -08:00
Victor Zverovich
3b70966df5
Add width and alignment support to error_code
2024-09-21 07:58:03 -07:00
Yedidya Feldblum
07e70151d5
format std::reference_wrapper
2024-09-16 19:05:18 -07:00
Vladislav Shchapov
22d50c1a9c
Add support formatting std::expected<void, E>
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-09-04 12:31:44 -07:00
Victor Zverovich
377cf203e3
Add opt out for built-in types
2024-08-29 11:21:29 -07:00
Vladislav Shchapov
d326c7298a
Fix conversion a surrogate pair ( #4095 )
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-07-30 07:27:11 -07:00
Vladislav Shchapov
a96259701e
Improve std::complex formatter ( #4050 )
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-07-04 17:24:01 -07:00
Matthias Moulin
728f9bc388
Added std::type_info formatter ( #3978 )
...
* Added std::type_info formatter;
* Reused std::type_info formatter in std::exception formatters;
* Updated MSVC std::type_info outputting to exclude all class, struct and enum occurences.
2024-05-28 10:57:08 -07:00
Vladislav Shchapov
45b772f85c
Improve std::complex formatter to be compatible with P2197R0 ( #3900 )
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-20 13:31:32 -07:00
Victor Zverovich
c0dac83982
Use p2197 format for complex by default
2024-03-19 07:55:45 +09:00
Vladislav Shchapov
c710bfa10c
Apply clang-format
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-17 15:26:18 -07:00
Vladislav Shchapov
73f2b344b2
Add std::complex formatter
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2024-03-17 15:26:18 -07:00
Dominic Pöschko
e5bab8dab4
added formatter for std::expected ( #3834 )
2024-02-03 09:06:15 -08:00
Victor Zverovich
fd87a23d34
Reduce memory dependency
2024-01-10 20:00:15 -08:00
Victor Zverovich
47c8f63d02
Remove redundant specifier
2023-12-28 07:32:07 -08:00
Victor Zverovich
f575089243
Simplify test
2023-12-01 08:52:42 -08:00
Félix-Antoine Constantin
99b9fbf8ef
Add formatter for std::source_location ( #3730 )
2023-11-30 10:05:56 -08:00
Victor Zverovich
04718008ab
Minor cleanup
2023-11-30 07:43:31 -08:00
js324
b87ea22e29
Add native and generic representation for filesystem::path format spec ( #3729 )
2023-11-29 14:49:36 -08:00
Ole Bøe
864a8b5f38
fix: support optional<T> with format_as(T) ( #3713 )
...
Formatting a std::optional<T> where T had a custom format_as(T) function failed to compile with clang,
due to set_debug_format being hidden by private inheritance. This fix makes the function available through a using clause.
2023-11-16 15:02:33 -08:00
Victor Zverovich
bf497ac068
Cleanup test
2023-10-08 07:30:08 -07:00
Giel van Schijndel
f76603f21e
fix: make std::bitset formattable again ( #3660 )
...
* fix: make std::bitset formattable again
It used to be formattable via operator<<(ostream&) implicitly. Make it
formattable again, but this time via formatter specialization.
* fix: make nested_formatter constexpr default constructible
2023-10-03 09:53:47 -07:00
Alex Guteniev
9b74160817
atomic_flag formatting (#3594 )
2023-08-25 08:06:10 -07:00
Zhanwei Wang
5a866fe852
Add formatter for std::atomic ( #3574 )
2023-08-14 08:34:31 -07:00
Vladislav Shchapov
aeb6ad4dd0
Added formatter for bit_reference-like types ( #3570 )
...
* Add test for std::vector<bool>::reference
Co-authored-by: Felix <felix-antoine.constantin@polymtl.ca>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
* Add test for std::bitset<N>::reference
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
* Add test for const std::bitset<N>::reference and const std::vector<bool>::reference
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
* Add bit_reference-like formatter
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
* Use std::addressof
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
---------
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Co-authored-by: Felix <felix-antoine.constantin@polymtl.ca>
2023-08-06 11:36:30 -07:00
Victor Zverovich
3dec65b7fd
Use replacement character in path
2023-07-22 09:07:28 -07:00
Victor Zverovich
ac0ab8eff3
Improve path formatter
2023-07-20 17:49:12 -07:00
Victor Zverovich
1e0ce567ef
Fix formatting of paths containing invalid Unicode
2023-05-07 10:05:15 -07:00
Victor Zverovich
b12ffea4fb
Add filesystem_error test back
2023-05-06 07:49:46 -07:00
Victor Zverovich
02cae7e48a
Improve handling of Unicode in paths
2023-04-30 09:58:59 -07:00
TheOmegaCarrot
d8e1c4265a
fix case of variant which is valueless by exception ( #3347 )
...
Co-authored-by: theomegacarrot <theomegacarrot@gmail.com>
2023-03-18 07:07:06 -07:00