If it doesn't, do you know what compiler or version will?
See cppreference/format.
If it doesn't, do you know what compiler or version will?
See cppreference/format.
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.
See Compiler support here :-
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.
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::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: