'Does GCC support C++20 std::format?
If it doesn't, do you know what compiler or version will?
See cppreference/format.
Solution 1:[1]
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.
Solution 2:[2]
As of May 2022, NO, GCC 11.2 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.
See Compiler support here :-
Solution 3:[3]
As of today (13 Apr 2022), GCC 11.2 does not support this feature. Or rather, it's 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::formatsupport 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:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zoe stands with Ukraine |
| Solution 2 | |
| Solution 3 |
