|
|
Member functions | ||||
Iterators | ||||
Capacity | ||||
Element access | ||||
Modifiers | ||||
Non-member functions | ||||
Helper classes | ||||
formatter<std::basic_stacktrace> |
Defined in header <stacktrace> | ||
template<class Allocator> struct formatter<std::basic_stacktrace<Allocator>>; | (since C++23) | |
The template specialization ofstd::formatter forstd::basic_stacktrace<Allocator> allows users to convert a stacktrace object to string usingformatting functions such asstd::format.
No format specifier is allowed.
A stacktrace objects is formatted as if by copyingstd::to_string
(s) to the output.
#include <format>#include <iostream>#include <stacktrace> int main(){auto trace= std::stacktrace::current();std::cout<<std::format("{}\n", trace);}
Possible output:
0# 0x0000000000402D97 in ./prog.exe 1# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 2# 0x0000000000402CA9 in ./prog.exe
(C++20) | defines formatting rules for a given type (class template)[edit] |
(C++23) | prints tostdout or a file stream usingformatted representation of the arguments (function template)[edit] |