std::basic_...ce::max_size(3)

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

okay bestie, welcome to the C++ Standard Libary corner of the man pages πŸ’… this one is all about std::basic_stacktrace::max_size β€” and yes, the truncated title std::basic_...ce::max_size is just the man page being dramatic and saving space, iykyk.

✨ NAME ✨

std::basic_stacktrace::max_size β€” std::basic_stacktrace::max_size 🫢 literally the member that tells you the biggest number of elements the underlying container can theoretically hold.

🌸 Synopsis 🌸

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

Returns the maximum number of elements the underlying container (typically a std::vector) is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest underlying container. No cap, it's giving theoretical maximum ✨

πŸŽ€ Parameters πŸŽ€

(none) β€” not a single argument, she takes zero notes πŸ’…

πŸ’– Return value πŸ’–

Maximum number of elements. That's it, that's the whole vibe.

πŸ”₯ Complexity πŸ”₯

Constant. O(1) energy, no scrolling required.

πŸ‘‘ Notes πŸ‘‘

This value typically reflects the theoretical limit on the size of the underlying container, at most std::numeric_limits<difference_type>::max(). At runtime, the size of the container may be limited to a value smaller than max_size() by the amount of RAM available. So like… she could hold that many, but your RAM said β€œbestie no” 😭

🌈 Example 🌈

// Run this code

        #include <iostream>
        #include <stacktrace>

        int main()
        {
            std::stacktrace trace;
            std::cout << "Maximum size of a 'basic_stacktrace' is " <<
       trace.max_size() << "\n";
        }

πŸ“ Possible output:

Maximum size of a 'basic_stacktrace' is 1152921504606846975

πŸ¦‹ See also

  • size β€” returns the number of stacktrace entries (public member function). The actual count, not the dream count πŸ’œ

that's the whole page, bestie! sourced from http://cppreference.com, dated 2024.06.10 β€” and the manual is std::basic_...ce::max_size(3), mwah πŸ’‹

πŸ“¦ where this page comes from