Namespaces
Variants
Views
Actions

std::stacktrace_entry::source_line

From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)

(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)

Elementary string conversions
(C++17)
(C++17)

Stacktrace
 
std::stacktrace_entry
Member functions
Observers
Query
stacktrace_entry::source_line
(C++23)
Non-member functions
(C++23)(C++23)
(C++23)
(C++23)
Helper classes
 
std::uint_least32_t source_line() const;
(since C++23)

Returns a 1-based line number that lexically relates to the evaluation represented by *this, or 0 on failure other than allocation failure, e.g. when *this is empty.

Either source_file returns the presumed source file name and source_line returns the presumed line number, or source_file returns the actual source file name and source_line returns the actual line number.

Contents

[edit] Parameters

(none)

[edit] Return value

The line number specified above on success, 0 on failure other than allocation failure.

[edit] Exceptions

Throws std::bad_alloc if memory for the internal data structures cannot be allocated.

[edit] Notes

The presumed line number is what the predefined macro __LINE__ expands to, and can be changed by the #line directive.

This function is not required to be noexcept because getting source line requires allocation on some platforms.

[edit] Example

[edit] See also

return the line number represented by this object
(public member function of std::source_location) [edit]