Sujet : Re: We have a new standard!
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.c++Date : 02. Jan 2025, 16:35:14
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250102173514.0000191d@yahoo.com>
References : 1 2 3 4 5 6
User-Agent : Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
On Thu, 2 Jan 2025 13:51:53 +0100
David Brown <
david.brown@hesbynett.no> wrote:
Could this all have been done from the start of C++? In theory, yes
- in practice no. std::format and std::print rely on various modern
C++ features, such as compile-time evaluation of functions,
It does not look like dependence of std::format on compile-time
evaluation is a requirement of standard rather than implementation
choice of g++ and of clang++.
MSVC 19.30.30706 compiles the following code just fine:
#include <cstdio>
#include <format>
int main(int argc, char** argv)
{
if (argc >= 3) {
std::string s = std::format(argv[1], argv[2]);
printf("%s\n", s.c_str());
}
return 0;
}
When run, it produces expected results.
Or, may be, it's because this version of MSVC is not fully C++20
complient.