std::basic_stacktrace<Allocator>::size

Returns the number of entries in the stacktrace.

# Declarations

size_type size() const noexcept;

(since C++23)

# Return value

The number of entries in the stacktrace.

# Example

#include <stacktrace>
#include <iostream>
 
int main()
{ 
    auto trace = std::stacktrace::current();
 
    std::cout << "trace contains " << trace.size() << " entries.\n";
}

# See also