std::operator<<(std::basic_stacktrace)

Header: <stacktrace>

Inserts the description of st into the output stream os. Equivalent to return os « std::to_string(st);.

# Declarations

template< class Allocator >
std::ostream& operator<<( std::ostream& os, const std::basic_stacktrace<Allocator>& st );

(since C++23)

# Parameters

# Return value

os.

# Example

#include <stacktrace>
#include <iostream>
 
int main()
{
    std::cout << "The stacktrace obtained in the main function:\n";
    std::cout << std::stacktrace::current() << '\n';
    []{
        std::cout << "The stacktrace obtained in a nested lambda:\n";
        std::cout << std::stacktrace::current() << '\n';
    }();
}

# See also