-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSourceLocation.cpp
More file actions
41 lines (33 loc) · 1.17 KB
/
SourceLocation.cpp
File metadata and controls
41 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// =====================================================================================
// SourceLocation.cpp // std::source_location
// =====================================================================================
module modern_cpp:source_location;
namespace StdSourceLocation {
static void log(
const std::string_view message,
const std::source_location location = std::source_location::current())
{
std::println("File: {}", location.file_name());
std::println("Function Name: {}", location.function_name());
std::println("Column : {}", location.column());
std::println("Line: {}", location.line());
std::println();
}
template<typename T>
static void function(T x)
{
log(x);
}
static void test_01() {
log("Hello World!");
function("Hello Function!");
}
}
void main_source_location()
{
using namespace StdSourceLocation;
test_01();
}
// =====================================================================================
// End-of-File
// =====================================================================================