If it doesn't, do you know what compiler or version will?
See cppreference/format.
C++20 Support in GCC GCC has experimental support for the latest revision of the C++ standard, which was published in 2020. C++20 features are available since GCC 8.
GCC supports the original ISO C++ standard published in 1998, and the 2011, 2014, 2017 and mostly 2020 revisions. The original ISO C++ standard was published as the ISO standard (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 2003 (ISO/IEC 14882:2003).
Clang doesn't use C++20 by default, so you must specify it explicitly. Clang uses libstdc++ standard library on Linux by default (for compatibility with shared libraries), so in such case you won't be using the Clang's standard library by default, and libstdc++ hasn't implemented text formatting yet.
Visual Studio 2019 (latest version 16.10, on Windows) is the only IDE currently coming with a compiler that fully supports C++20.
Does gcc support C++20
std::format
?
Not yet!
There's no compiler support yet, not even gcc 11. See Text formatting
in Library features.
Compiler support for C++20 library features
As of September 2022, NO, GCC 12 doesn't support std::format yet.
MSVC (version 16.10 and above) is the only compiler that fully supports std::format. Clang 14 (with libc++14) also has almost full support for std::format.
Since std::format is based on fmt library, you can use fmt::format until std::format arrives in GCC.
{fmt} library GitHub repo
See Compiler support here :-
As of today (5 September 2022), GCC 12.2 does not support this feature. Or rather, its standard library implementation doesn't support it (cause it's a library feature, not the compiler-one).
You can try Clang 14.0.0 and upward for now, but note following:
libc++ of Clang 14.0.0 has
std::format
support but: "The paper is implemented but still marked as an incomplete feature. Not yet implemented LWG-issues will cause API and ABI breakage" as mentioned here
Also you can try MSVC 16.10 and upward. Support of std::format
is mentioned as complete.
Standard library current status can be seen here:
GCC: libstdc++
Clang: libc++
MSVC: msvcp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With