Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/stacktrace entry"

From cppreference.com
< cpp‎ | utility
m (Notes: + feature test macro; upd. the link to boost.stacktrace (latest release vs fixed version))
m
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{cpp/title|stacktrace_entry}}
 
{{cpp/title|stacktrace_entry}}
 
{{cpp/utility/stacktrace_entry/navbar}}
 
{{cpp/utility/stacktrace_entry/navbar}}
{{ddcl | header=stacktrace | since=c++23 |
+
{{ddcl|header=stacktrace|since=c++23|
 
class stacktrace_entry;
 
class stacktrace_entry;
 
}}
 
}}
Line 11: Line 11:
 
===Member types===
 
===Member types===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc | {{tt|native_handle_type}}{{mark c++23}} | implementation-defined native handle type}}
+
{{dsc|{{tt|native_handle_type}}|implementation-defined native handle type}}
 
{{dsc end}}
 
{{dsc end}}
  
 
===Member functions===
 
===Member functions===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/utility/stacktrace_entry/dsc constructor}}
+
{{dsc inc|cpp/utility/stacktrace_entry/dsc constructor}}
{{dsc mem dtor | nolink=true | notes={{mark c++23}} | destroys the {{tt|stacktrace_entry}} }}
+
{{dsc mem dtor|nolink=true|destroys the {{tt|stacktrace_entry}}}}
{{dsc mem fun | cpp/utility/stacktrace_entry/operator{{=}} | notes={{mark c++23}} | assigns the contents of one {{tt|stacktrace_entry}} to another}}
+
{{dsc mem fun|cpp/utility/stacktrace_entry/operator{{=}}|assigns the contents of one {{tt|stacktrace_entry}} to another}}
  
{{dsc h2 | Observers}}
+
{{dsc h2|Observers}}
{{dsc mem fun | cpp/utility/stacktrace_entry/native_handle | notes={{mark c++23}} | gets the implementation-defined native handle of the {{tt|stacktrace_entry}} }}
+
{{dsc mem fun|cpp/utility/stacktrace_entry/native_handle|gets the implementation-defined native handle of the {{tt|stacktrace_entry}}}}
{{dsc mem fun | cpp/utility/stacktrace_entry/operator bool | notes={{mark c++23}} | checks whether the {{tt|stacktrace_entry}} is empty}}
+
{{dsc mem fun|cpp/utility/stacktrace_entry/operator bool|checks whether the {{tt|stacktrace_entry}} is empty}}
  
{{dsc h2 | Query}}
+
{{dsc h2|Query}}
{{dsc mem fun | cpp/utility/stacktrace_entry/description | notes={{mark c++23}} | gets the description of the evaluation represented by the {{tt|stacktrace_entry}} }}
+
{{dsc mem fun|cpp/utility/stacktrace_entry/description|gets the description of the evaluation represented by the {{tt|stacktrace_entry}}}}
{{dsc inc | cpp/utility/stacktrace_entry/dsc source_file}}
+
{{dsc inc|cpp/utility/stacktrace_entry/dsc source_file}}
{{dsc inc | cpp/utility/stacktrace_entry/dsc source_line}}
+
{{dsc inc|cpp/utility/stacktrace_entry/dsc source_line}}
 
{{dsc end}}
 
{{dsc end}}
  
 
===Non-member functions===
 
===Non-member functions===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc fun | cpp/utility/stacktrace_entry/operator cmp | title=operator==<br>operator<=> | notes={{mark c++23}} | compares two {{tt|stacktrace_entry}} values}}
+
{{dsc fun|cpp/utility/stacktrace_entry/operator cmp|title=operator==<br>operator<=>|notes={{mark c++23}}|compares two {{tt|stacktrace_entry}} values}}
{{dsc inc | cpp/utility/stacktrace_entry/dsc to_string}}
+
{{dsc inc|cpp/utility/stacktrace_entry/dsc to_string}}
{{dsc inc | cpp/utility/stacktrace_entry/dsc operator ltlt}}
+
{{dsc inc|cpp/utility/stacktrace_entry/dsc operator ltlt}}
 
{{dsc end}}
 
{{dsc end}}
  
 
===Helper classes===
 
===Helper classes===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/utility/stacktrace_entry/dsc hash}}
+
{{dsc inc|cpp/utility/stacktrace_entry/dsc hash}}
 +
{{dsc inc|cpp/utility/stacktrace_entry/dsc formatter}}
 
{{dsc end}}
 
{{dsc end}}
  
 
===Notes===
 
===Notes===
 
{{tt|boost::stacktrace::frame}} (available in [https://www.boost.org/doc/libs/release/doc/html/stacktrace.html Boost.Stacktrace]) can be used instead when {{tt|std::stacktrace_entry}} is not available.
 
{{tt|boost::stacktrace::frame}} (available in [https://www.boost.org/doc/libs/release/doc/html/stacktrace.html Boost.Stacktrace]) can be used instead when {{tt|std::stacktrace_entry}} is not available.
 
+
{{feature test macro|__cpp_lib_stacktrace|std=C++23|value=202011L|[[cpp/error#Stacktrace|Stacktrace library]]}}
{{feature test macro|__cpp_lib_stacktrace}}
+
  
 
===Example===
 
===Example===
Line 52: Line 52:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/utility/dsc basic_stacktrace}}
+
{{dsc inc|cpp/utility/dsc basic_stacktrace}}
{{dsc inc | cpp/utility/dsc source_location}}
+
{{dsc inc|cpp/utility/dsc source_location}}
 
{{dsc end}}
 
{{dsc end}}
  
 
{{langlinks|es|ja|ru|zh}}
 
{{langlinks|es|ja|ru|zh}}

Latest revision as of 14:07, 30 October 2024

 
 
 
 
Defined in header <stacktrace>
class stacktrace_entry;
(since C++23)

The stacktrace_entry class provides operations for querying information about an evaluation in a stacktrace. Each stacktrace_entry object is either empty, or represents an evaluation in a stacktrace.

stacktrace_entry models std::regular and std::three_way_comparable<std::strong_ordering>.

Contents

[edit] Member types

native_handle_type implementation-defined native handle type

[edit] Member functions

constructs a new stacktrace_entry
(public member function) [edit]
(destructor)
destroys the stacktrace_entry
(public member function)
assigns the contents of one stacktrace_entry to another
(public member function)
Observers
gets the implementation-defined native handle of the stacktrace_entry
(public member function)
checks whether the stacktrace_entry is empty
(public member function)
Query
gets the description of the evaluation represented by the stacktrace_entry
(public member function)
gets the name of the source file that lexically contains the expression or statement whose evaluation is represented by the stacktrace_entry
(public member function) [edit]
gets the line number that lexically relates the evaluation represented by the stacktrace_entry
(public member function) [edit]

[edit] Non-member functions

compares two stacktrace_entry values
(function)
(C++23)
returns a string with a description of the stacktrace_entry
(function) [edit]
performs stream output of stacktrace_entry
(function template) [edit]

[edit] Helper classes

hash support for std::stacktrace_entry
(class template specialization) [edit]
formatting support for stacktrace_entry
(class template specialization) [edit]

[edit] Notes

boost::stacktrace::frame (available in Boost.Stacktrace) can be used instead when std::stacktrace_entry is not available.

Feature-test macro Value Std Feature
__cpp_lib_stacktrace 202011L (C++23) Stacktrace library

[edit] Example

[edit] See also

approximate representation of an invocation sequence consists of stacktrace entries
(class template) [edit]
a class representing information about the source code, such as file names, line numbers, and function names
(class) [edit]