source_location: nichtdeklarierter Bezeichner
-
Hi,
Mein Visual Studio 2022 erkennt nicht die Klasse source_location (struct?)
Kann man da was tun?
Vielen Dank#include <iostream> #include <string_view> #include <source_location> void log(const std::string_view message, const std::source_location location = std::source_location::current()) { std::cout << "file: " << location.file_name() << "(" << location.line() << ":" << location.column() << ") `" << location.function_name() << "`: " << message << '\n'; } template <typename T> void fun(T x) { log(x); } int main(int, char* []) { log("Hello world!"); fun("Hello C++20!"); }
-
Du musst den Compilerschalter
/std:c++20
nutzen.
-
@SeppJ Danke SeppJ und schönes Wochenende