cross-platform pre c++20 source_location
It uses :
#include <source_location>
or
#include <experimental/source_location>
if they are available.
Linux Clang | Linux GCC | MacOS Clang | MacOS GCC | Windows M2sys | Windows MSVC | |
---|---|---|---|---|---|---|
Github |
#include <iostream>
#include <source_location/source_location.hpp>
int main()
{
source_location loc(source_location::current());
std::cout << loc.file_name() << std::endl;
std::cout << loc.function_name() << std::endl;
std::cout << loc.line() << std::endl;
}
- On
Linux
:gcc-9
:c++98
,c++11
,c++17
,c++20
gcc-10
:c++98
,c++11
,c++17
,c++20
clang-10
:c++98
,c++11
,c++17
,c++20
clang-11
:c++98
,c++11
,c++17
,c++20
- On
MacOS
:gcc-9
:c++98
,c++11
,c++17
,c++20
gcc-10
:c++98
,c++11
,c++17
,c++20
gcc-11
:c++98
,c++11
,c++17
,c++20
clang-12
:c++98
,c++11
,c++17
,c++20
- On
Windows
:MSVC 19.28.29915.0
:c++98
,c++11
,c++17
,c++20
MSYS2 GNU 10.2.0
:c++98
,c++11
,c++17
,c++20
MSYS2 Clang 12.0.0
:c++98
,c++11
,c++17
,c++20