![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
The source_location sub-package provides a facility akin to that provided by the C++20 std::source_location class.
The public header is
The Bazel target is
arene::base::src_line_info stores information about a line of code: the name of the source file where it is located, the name of the function where it is located, and the line number. This is similar to std::source_location, except that no column number is provided, as it is not available without the compiler intrinsics used for std::source_location.
The main use case is in association with the ARENE_GET_SRC_CODE_LOCATION_INFO macro, which captures the information about the source file where the macro is used:
Sadly, this cannot meaningfully be used as a default argument in a function definition (like std::source_location::current()), since it would yield the location of the function definition, and not the location of the function call.