namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


kennen:include:source_location

<source_location>

Beispiel

TODO: Test ohne experimental, sobald Compiler-Unterstützung vorhanden ist.

source_location.cpp
#include <iostream>
#include <string>
#include <experimental/source_location>
 
void log(std::string message,
         const std::experimental::source_location& location = std::experimental::source_location::current())
{
    std::cout << "info:"
              << location.function_name() << ":"
              << location.file_name() << ":"
              << location.line() << ":"
              << location.column() << " "
              << message << '\n';
}
 
int main()
{
    log("Hello world!");
}
kennen/include/source_location.txt · Zuletzt geändert: 2020-06-01 17:02 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki