Describe the bug
The <format> header currently includes <varaint> which is a big dependency. However, std::variant itself is not used in the implementation, only std::monostate which is a trivial struct. Is it possible to move std::monostate to a common header to be used from <format> and <variant> to break the unnecessary dependency and potentially reduce compile times?
Command-line test case
C:\Temp>type test.cc
#include <format>
int main() {
auto v = std::variant<int>();
}
C:\Temp>cl /I STL/stl/inc /std:c++latest test.cc
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.29917 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.
test.cc
Microsoft (R) Incremental Linker Version 14.29.29917.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
Expected behavior
The test shouldn't compile because <format> shoudn't provide std::variant.
STL version
4d7d4f1
Describe the bug
The
<format>header currently includes<varaint>which is a big dependency. However,std::variantitself is not used in the implementation, onlystd::monostatewhich is a trivial struct. Is it possible to movestd::monostateto a common header to be used from<format>and<variant>to break the unnecessary dependency and potentially reduce compile times?Command-line test case
Expected behavior
The test shouldn't compile because
<format>shoudn't providestd::variant.STL version
4d7d4f1