[stacktrace.entry] (original) (raw)

19 Diagnostics library [diagnostics]

19.6.3 Class stacktrace_entry [stacktrace.entry]

19.6.3.1 Overview [stacktrace.entry.overview]

namespace std { class stacktrace_entry { public: using native_handle_type = implementation-defined;constexpr stacktrace_entry() noexcept;constexpr stacktrace_entry(const stacktrace_entry& other) noexcept;constexpr stacktrace_entry& operator=(const stacktrace_entry& other) noexcept;~stacktrace_entry();constexpr native_handle_type native_handle() const noexcept;constexpr explicit operator bool() const noexcept; string description() const; string source_file() const; uint_least32_t source_line() const;friend constexpr bool operator==(const stacktrace_entry& x,const stacktrace_entry& y) noexcept;friend constexpr strong_ordering operator<=>(const stacktrace_entry& x,const stacktrace_entry& y) noexcept;};}

An object of type stacktrace_entry is either empty, or represents a stacktrace entry and provides operations for querying information about it.

19.6.3.3 Observers [stacktrace.entry.obs]

constexpr native_handle_type native_handle() const noexcept;

The semantics of this function areimplementation-defined.

Remarks: Successive invocations of the native_handle function for an unchanged stacktrace_entry object return identical values.

constexpr explicit operator bool() const noexcept;

Returns: false if and only if *this is empty.

19.6.3.4 Query [stacktrace.entry.query]

[Note 1:

All the stacktrace_entry query functions treat errors other than memory allocation errors as “no information available” and do not throw in that case.

— _end note_]

string description() const;

Returns: A description of the evaluation represented by *this, or an empty string.

Throws: bad_alloc if memory for the internal data structures or the resulting string cannot be allocated.

string source_file() const;

Returns: The presumed or actual name of the source file ([cpp.predefined]) that lexically contains the expression or statement whose evaluation is represented by *this, or an empty string.

Throws: bad_alloc if memory for the internal data structures or the resulting string cannot be allocated.

uint_least32_t source_line() const;

Returns: 0, or a 1-based line number that lexically relates to the evaluation represented by *this.

If source_file returns the presumed name of the source file, returns the presumed line number; if source_file returns the actual name of the source file, returns the actual line number.

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

19.6.3.5 Comparison [stacktrace.entry.cmp]

friend constexpr bool operator==(const stacktrace_entry& x, const stacktrace_entry& y) noexcept;

Returns: true if and only if x and y represent the same stacktrace entry or both x and y are empty.