std::formatter<std::basic_stacktrace>

Header: <stacktrace>

The template specialization of std::formatter for std::basic_stacktrace allows users to convert a stacktrace object to string using formatting functions such as std::format.

# Declarations

template< class Allocator >
struct formatter<std::basic_stacktrace<Allocator>>;

(since C++23)

# Example

#include <format>
#include <iostream>
#include <stacktrace>
 
int main()
{
    auto trace = std::stacktrace::current();
    std::cout << std::format("{}\n", trace);
}

# See also