[stacktrace.basic.overview]

# 19 Diagnostics library [[diagnostics]](./#diagnostics)

## 19.6 Stacktrace [[stacktrace]](stacktrace#basic.overview)

### 19.6.4 Class template basic_stacktrace [[stacktrace.basic]](stacktrace.basic#overview)

#### 19.6.4.1 Overview [stacktrace.basic.overview]

namespace std {template<class Allocator>class [basic_stacktrace](#lib:basic_stacktrace "19.6.4.1 Overview [stacktrace.basic.overview]") {public:using value_type = stacktrace_entry; using const_reference = const value_type&; using reference = value_type&; using const_iterator = *implementation-defined*; // see [[stacktrace.basic.obs]](stacktrace.basic.obs "19.6.4.3 Observers")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; // [[stacktrace.basic.cons]](stacktrace.basic.cons "19.6.4.2 Creation and assignment"), 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(); // [[stacktrace.basic.obs]](stacktrace.basic.obs "19.6.4.3 Observers"), observers allocator_type get_allocator() const noexcept;

 const_iterator begin() const noexcept;
 const_iterator end() const noexcept;
 const_reverse_iterator rbegin() const noexcept;
 const_reverse_iterator rend() const noexcept;

 const_iterator cbegin() const noexcept;
 const_iterator cend() const noexcept;
 const_reverse_iterator crbegin() const noexcept;
 const_reverse_iterator crend() const noexcept; bool empty() const noexcept;
 size_type size() const noexcept;
 size_type max_size() const noexcept;

 const_reference operator[](size_type) const;
 const_reference at(size_type) const; // [[stacktrace.basic.cmp]](stacktrace.basic.cmp "19.6.4.4 Comparisons"), comparisonstemplate<class Allocator2>friend bool 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; // [[stacktrace.basic.mod]](stacktrace.basic.mod "19.6.4.5 Modifiers"), 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*};}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L1958)

The class template basic_stacktrace satisfies
the requirements
of a reversible container ([[container.rev.reqmts]](container.rev.reqmts "23.2.2.3 Reversible container requirements")),
of an allocator-aware container ([[container.alloc.reqmts]](container.alloc.reqmts "23.2.2.5 Allocator-aware containers")), and
of a sequence container ([[sequence.reqmts]](sequence.reqmts "23.2.4 Sequence containers")),
except that

- [(1.1)](#1.1)

only move, assignment, swap, and
operations defined for const-qualified sequence containers are supported and,

- [(1.2)](#1.2)

the semantics of comparison functions
are different from those required for a container[.](#1.sentence-1)
