Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
std::source_location Class Reference

Utility class to emulates std::source_location class introduced in c++20 This class provides information about the source location where it is used. More...

#include <shambase/include/shambase/cxxbackports/source_location.hpp>

Public Member Functions

constexpr unsigned line () const noexcept
 Returns the line number of the source location.
 
constexpr unsigned column () const noexcept
 Returns the column offset of the source location.
 
constexpr const char * file_name () const noexcept
 Returns the file name of the source location.
 
constexpr const char * function_name () const noexcept
 Returns the function name of the source location.
 

Static Public Member Functions

static constexpr source_location current () noexcept
 Returns the source location where this function is called.
 

Detailed Description

Utility class to emulates std::source_location class introduced in c++20 This class provides information about the source location where it is used.

See also
https://en.cppreference.com/w/cpp/utility/source_location

Example of usage :

std::cout << "file: "
<< location.file_name() << '('
<< location.line() << ':'
<< location.column() << ") `"
<< location.function_name() << '\n';
}
Utility class to emulates std::source_location class introduced in c++20 This class provides informat...
static constexpr source_location current() noexcept
Returns the source location where this function is called.

Definition at line 87 of file source_location.hpp.

Member Function Documentation

◆ column()

std::source_location::column ( ) const
constexprnoexcept

Returns the column offset of the source location.

Returns
The column offset.

◆ current()

std::source_location::current ( )
staticconstexprnoexcept

Returns the source location where this function is called.

Returns
The source location.

◆ file_name()

std::source_location::file_name ( ) const
constexprnoexcept

Returns the file name of the source location.

Returns
The file name.

◆ function_name()

std::source_location::function_name ( ) const
constexprnoexcept

Returns the function name of the source location.

Returns
The function name.
+ Here is the call graph for this function:

◆ line()

std::source_location::line ( ) const
constexprnoexcept

Returns the line number of the source location.

Returns
The line number.

The documentation for this class was generated from the following file: