Liste des Groupes | Revenir à cl c++ |
On Thu, 2 Jan 2025 13:51:53 +0100<https://en.cppreference.com/w/cpp/utility/format/format>
David Brown <david.brown@hesbynett.no> wrote:
>It does not look like dependence of std::format on compile-time
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,
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.
Les messages affichés proviennent d'usenet.