std::basic_...ktrace::size(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

NAME πŸ’…

okay so this is the manual page for std::basic_stacktrace::size β€” and yes, the NAME line is literally std::basic_stacktrace::size - std::basic_stacktrace::size, she is self-titled and iconic. It lives in the C++ Standard Libary manual (typo preserved, it's canon), and the header shows her as std::basic_...ktrace::size(3). Bestie, we know what's up.

Synopsis ✨

size_type size() const noexcept;  (since C++23)

Returns the number of entries in the stacktrace. That's the whole gig. πŸŽ€

Parameters 🫢

(none) β€” literally no arguments. She takes nothing and still serves.

Return value πŸ’–

The number of entries in the stacktrace.

Complexity 🌸

Constant. no cap, that's it.

Example πŸ¦‹

The following code uses size to display the number of entries in the current stacktrace:

// Run this code

#include <stacktrace>
#include <iostream>

int main()
{
    auto trace = std::stacktrace::current();

    std::cout << "trace contains " << trace.size() << " entries.\n";
}

Possible output ⭐

trace contains 3 entries.

See also πŸ‘‘

  • empty β€” checks whether the basic_stacktrace is empty (public member function).
  • max_size β€” returns the maximum possible number of stacktrace entries (public member function).

That's the whole page, bestie. Cute little sign-off: this came from http://cppreference.com, dated 2024.06.10, and the page header title is std::basic_...ktrace::size(3) πŸ’œ

πŸ“¦ where this page comes from