std::flat_m...t::max_size(3)
πΈ NAME πΈ
std::flat_multiset::max_size β bestie, it's literally std::flat_multiset::max_size π
(yes the name is the whole vibe, this is from the C++ Standard Library manual, welcome)
β¨ SYNOPSIS β¨
size_type max_size() const noexcept; (since C++23)
okay so this returns the maximum number of elements the container is able to hold due to system or library implementation limitations β like, std::distance(begin(), end()) for the largest container possible. big main character energy π₯
π PARAMETERS π
(none)
she takes nothing, she gives everything π«Ά
β RETURN VALUE β
Maximum number of elements. that's it, that's the tea π
π¦ COMPLEXITY π¦
Constant. literally constant, no drama, no waiting, icon behaviour π
π NOTES π
This value typically reflects the theoretical limit on the size of the 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, the theoretical limit is giving dream big π but your actual RAM said "be so fr right now" π
π EXAMPLE π
// Run this code
#include <iostream>
#include <flat_set>
#include <locale>
int main()
{
std::flat_multiset<char> q;
std::cout.imbue(std::locale("en_US.UTF-8"));
std::cout << "Maximum size of a std::flat_multiset is " <<
q.max_size() << '\n';
}
Possible output:
Maximum size of a std::flat_multiset is 768,614,336,404,564,650
not that number being absolutely unhinged π but slay, we love a big max_size
π SEE ALSO π
sizeβ returns the number of elements (public member function) β the lowkey cousin ofmax_size(), also iconic π
and that's the whole page bestie, no cap ππ β this was from cppreference.com, version 2024.06.10, std::flat_m...t::max_size(3) β go forth and know your theoretical limits, mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms