C++ Library - <stacktrace>



The <stacktrace> header in C++20, introduces a way to work with the stack traces. It provides a snapshot of the function call history at a particular point in the program execution, which is helpful for debugging and error handling.

Before C++20, obtaining stack traces requires a platform-specific libraries or third-party tools making it a messed task. However, with the introduction of <stacktrace> it regulates the process, enabling the cross-platform compatibility and reducing the dependence on the external libraries.

Including <stacktrace> Header

To include the <stacktrace> header in your C++ program, you can use the following syntax.

#include <stacktrace>

Functions of <stacktrace> Header

Below is list of all functions from <stacktrace> header.

Sr.No Functions & Description
1 operator=

It assigns to the basic_stacktrace.

2 current

It obtains the current stacktrace or its given part.

3 get_allocator

It returns the associated allocator.

4 begin

It returns an iterator to the beginning.

5 cbegin

It returns an constant iterator to the beginning.

6 end

It returns an iterator to the end.

7 cend

It returns an constant iterator to the end.

8 rbegin

It returns a reverse iterator to the beginning.

9 crbegin

It returns a constant reverse iterator to the beginning.

10 rend

It returns a reverse iterator to the end.

11 crend

It returns a constant reverse iterator to the end.

12 empty

It checks whether the stacktrace is empty.

13 size

It returns the number of stacktrace entries.

14 max_size

It returns the maximum possible number of stacktrace entries.

15 operator[]

It access specified stacktrace entry.

16 at

It access specified stacktrace entry with bounds checking.

17 swap

It swaps the contents.

Non-member functions

Sr.No Functions & Description
1 operator==

It compares the sizes and the contents of two basic_stacktrace values.

2 to_string

It returns a string with a description of the stacktrace.

3 operator<<

It performs stream output of stracktrace.

Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy