Standard library header <stacktrace> (C++23)
From cppreference.com
This header is part of the diagnostics library.
Classes | ||
(C++23) | representation of an evaluation in a stacktrace (class) | |
(C++23) | approximate representation of an invocation sequence consists of stacktrace entries (class template) | |
hash support for std::stacktrace_entry (class template specialization) | ||
hash support for std::basic_stacktrace (class template specialization) | ||
Forward declarations | ||
Defined in header <functional> | ||
(C++11) | hash function object (class template) |
Type aliases | |
Alias | Type |
std::stacktrace | std::basic_stacktrace<std::allocator<std::stacktrace_entry>> |
std::pmr::stacktrace | std::pmr::basic_stacktrace< std::pmr::polymorphic_allocator<std::stacktrace_entry>> |
Functions | |
specializes the std::swap algorithm (function template) | |
(C++23) | returns a string with a description of the stacktrace_entry (function) |
(C++23) | returns a string with a description of the basic_stacktrace (function template) |
(C++23) | performs stream output of stacktrace_entry (function template) |
(C++23) | performs stream output of basic_stracktrace (function template) |
[edit]Synopsis
namespace std {// class stacktrace_entryclass stacktrace_entry; // class template basic_stacktracetemplate<class Allocator>class basic_stacktrace; // basic_stacktrace typedef namesusing stacktrace = basic_stacktrace<allocator<stacktrace_entry>>; // non-member functionstemplate<class Allocator>void swap(basic_stacktrace<Allocator>& a, basic_stacktrace<Allocator>& b)noexcept(noexcept(a.swap(b))); string to_string(const stacktrace_entry& f); template<class Allocator> string to_string(const basic_stacktrace<Allocator>& st); ostream& operator<<(ostream& os, const stacktrace_entry& f); template<class Allocator> ostream& operator<<(ostream& os, const basic_stacktrace<Allocator>& st); namespace pmr {using stacktrace =std::basic_stacktrace<polymorphic_allocator<stacktrace_entry>>;} // hash supporttemplate<class T>struct hash;template<>struct hash<stacktrace_entry>;template<class Allocator>struct hash<basic_stacktrace<Allocator>>;}
[edit]Class std::stacktrace_entry
namespace std {class stacktrace_entry {public:using native_handle_type =/* implementation-defined */; // constructorsconstexpr stacktrace_entry()noexcept;constexpr stacktrace_entry(const stacktrace_entry& other)noexcept;constexpr stacktrace_entry& operator=(const stacktrace_entry& other)noexcept; ~stacktrace_entry(); // observersconstexpr native_handle_type native_handle()constnoexcept;constexprexplicit operator bool()constnoexcept; // query string description()const; string source_file()const; uint_least32_t source_line()const; // comparisonfriendconstexprbool operator==(const stacktrace_entry& x, const stacktrace_entry& y)noexcept;friendconstexpr strong_ordering operator<=>(const stacktrace_entry& x, const stacktrace_entry& y)noexcept;};}
[edit]Class template std::basic_stacktrace
namespace std {template<class Allocator>class basic_stacktrace {public:using value_type = stacktrace_entry;using const_reference =const value_type&;using reference = value_type&;using const_iterator =/* implementation-defined */;using iterator = const_iterator;using reverse_iterator =std::reverse_iterator<iterator>;using const_reverse_iterator =std::reverse_iterator<const_iterator>;using difference_type =/* implementation-defined */;using size_type =/* implementation-defined */;using allocator_type = Allocator; // creation and assignmentstatic basic_stacktrace current(const allocator_type& alloc = allocator_type())noexcept;static basic_stacktrace current(size_type skip, const allocator_type& alloc = allocator_type())noexcept;static basic_stacktrace current(size_type skip, size_type max_depth, const allocator_type& alloc = allocator_type())noexcept; basic_stacktrace()noexcept(is_nothrow_default_constructible_v<allocator_type>);explicit basic_stacktrace(const allocator_type& alloc)noexcept; basic_stacktrace(const basic_stacktrace& other); basic_stacktrace(basic_stacktrace&& other)noexcept; basic_stacktrace(const basic_stacktrace& other, const allocator_type& alloc); basic_stacktrace(basic_stacktrace&& other, const allocator_type& alloc); basic_stacktrace& operator=(const basic_stacktrace& other); basic_stacktrace& operator=(basic_stacktrace&& other)noexcept( allocator_traits<Allocator>::propagate_on_container_move_assignment::value|| allocator_traits<Allocator>::is_always_equal::value); ~basic_stacktrace(); // observers allocator_type get_allocator()constnoexcept; const_iterator begin()constnoexcept; const_iterator end()constnoexcept; const_reverse_iterator rbegin()constnoexcept; const_reverse_iterator rend()constnoexcept; const_iterator cbegin()constnoexcept; const_iterator cend()constnoexcept; const_reverse_iterator crbegin()constnoexcept; const_reverse_iterator crend()constnoexcept; bool empty()constnoexcept; size_type size()constnoexcept; size_type max_size()constnoexcept; const_reference operator[](size_type)const; const_reference at(size_type)const; // comparisonstemplate<class Allocator2>friendbool operator==(const basic_stacktrace& x, const basic_stacktrace<Allocator2>& y)noexcept;template<class Allocator2>friend strong_ordering operator<=>(const basic_stacktrace& x, const basic_stacktrace<Allocator2>& y)noexcept; // modifiersvoid swap(basic_stacktrace& other)noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value|| allocator_traits<Allocator>::is_always_equal::value); private: vector<value_type, allocator_type> frames_;// exposition only};}