Reduce inclusion for <queue>, <stack>, <stacktrace>, and <thread> by frederick-vs-ja · Pull Request #5003 · microsoft/STL (original) (raw)

Since C++23, <queue>, <stack>, <stacktrace>, <thread>, and <vector> are required to provide formatter specializations. Previously, <format> was included by several headers to allow the formatter specializations to be properly defined. This PR splits out the necessary parts for formatter specializations and puts all formatter specializations other than those provided by <__msvc_formatter.hpp> into a new internal header <__msvc_ranges_tuple_formatter.hpp>.

The formattable concept is critical for these C++23 formatters. To ensure that formattable still works correctly, the definitions of basic_format_parse_context, basic_format_context, basic_format_arg, basic_format_args etc. are also moved to <__msvc_ranges_tuple_formatter.hpp>.

Newly added test files tests that these new formatter specializations are defined in the corresponding headers.

Notes: formatter<stacktrace_entry>::parse is templatized to allow _Fill_align_and_width_formatter_parse to be declared but not defined when including <stacktrace>.

⚠️ MSVC-internal changes are needed for the new internal header <__msvc_ranges_tuple_formatter.hpp>.