Namespaces
Variants
Views
Actions

std::basic_stacktrace

From cppreference.com
< cpp‎ | utility
 
 
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
basic_stacktrace
(C++23)
 
 
Defined in header <stacktrace>
template< class Allocator >
class basic_stacktrace;
(1) (since C++23)
using stacktrace =
    std::basic_stacktrace<std::allocator<std::stacktrace_entry>>;
(2) (since C++23)
1) The basic_stacktrace class template represents a snapshot of the whole stacktrace or its given part. It satisfies the requirement of AllocatorAwareContainer, SequenceContainer, and ReversibleContainer, except that only move, assignment, swap, and operations for const-qualified sequence containers are supported, and the semantics of comparison functions are different from those required for a container.
2) Convenience type alias for the basic_stacktrace using the default std::allocator.

The invocation sequence of the current evaluation x0 in the current thread of execution is a sequence (x0, ..., xn) of evaluations such that, for i≥0, xi is within the function invocation xi+1.

A stacktrace is an approximate representation of an invocation sequence and consists of stacktrace entries.

A stacktrace entry represents an evaluation in a stacktrace. It is represented by std::stacktrace_entry in the C++ standard library.

Contents

[edit] Template parameters

Allocator - An allocator that is used to acquire/release memory and to construct/destroy the elements in that memory. The type must meet the requirements of Allocator. The program is ill-formed if Allocator::value_type is not std::stacktrace_entry.

[edit] Member types

Member type Definition
value_type(C++23) std::stacktrace_entry
const_reference(C++23) const value_type&
reference(C++23) value_type&
const_iterator(C++23) implementation-defined const LegacyRandomAccessIterator type that models random_access_iterator
iterator(C++23) const_iterator
reverse_iterator(C++23) std::reverse_iterator<iterator>
reverse_const_iterator(C++23) std::reverse_iterator<const_iterator>
difference_type(C++23) implementation-defined signed integer type
size_type(C++23) implementation-defined unsigned integer type
allocator_type(C++23) Allocator

[edit] Member functions

creates a new basic_stacktrace
(public member function) [edit]
destroys the basic_stacktrace
(public member function)
(C++23)
assigns to the basic_stacktrace
(public member function) [edit]
[static] (C++23)
obtains the current stacktrace or its given part
(public static member function) [edit]
returns the associated allocator
(public member function)
Iterators
returns an iterator to the beginning
(public member function)
(C++23)
returns an iterator to the end
(public member function)
returns a reverse iterator to the beginning
(public member function)
(C++23)
returns a reverse iterator to the end
(public member function)
Capacity
(C++23)
checks whether the basic_stacktrace is empty
(public member function)
(C++23)
returns the number of stacktrace entries
(public member function)
(C++23)
returns the maximum possible number of stacktrace entries
(public member function)
Element access
access specified stacktrace entry
(public member function)
(C++23)
access specified stacktrace entry with bounds checking
(public member function)
Modifiers
(C++23)
swaps the contents
(public member function)

[edit] Non-member functions

compares the sizes and the contents of two basic_stacktrace values
(function template)
specializes the std::swap algorithm
(function template) [edit]
(C++23)
returns a string with a description of the basic_stacktrace
(function template) [edit]
performs stream output of basic_stracktrace
(function template) [edit]

[edit] Helper classes

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

[edit] Notes

Support for custom allocators is provided for using basic_stacktrace on a hot path or in embedded environments. Users can allocate stacktrace_entry objects on the stack or in some other place, where appropriate.

[edit] Example

[edit] See also

representation of an evaluation in a stacktrace
(class) [edit]