Does GCC support C++20 std::format?
Solution 1
Does gcc support c++20
std::format
?
Not yet!
I am the one expecting to use std::format
, but there's no compiler support yet, even gcc 10. See Text formating
in Library features.
Compiler support for C++20 library features
Solution 2
As of February 2022, NO, GCC doesn't support std::format yet.
MSVC (version 19.29 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 till std::format arrives in GCC.
Solution 3
As of today (12 Oct 2021), neither GCC 11.2 and Clang 13.0.0 support this feature. Or rather, their standard library implementation doesn't support it as it's a library feature.
Their standard library current status can be seen here:
P.S. (25 Jan 2022)
- 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
PorssiMies
Updated on June 07, 2022Comments
-
PorssiMies almost 2 years
If it doesn't, do you know what compiler or version will?
See cppreference/format.