std::flat_map::max_size(3)
πΈ NAME πΈ
NAME? It's literally std::flat_map::max_size - std::flat_map::max_size. Yes bestie, the description is also the name, iconic. This page lives under the C++ Standard Libary manual (their spelling, not mine π
).
β¨ Synopsis β¨
Okay so the signature is giving:
size_type max_size() const noexcept; (since C++23)
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations. Equivalent to std::min<size_type>(c.keys.max_size(), c.values.max_size()). Periodt.
π Parameters π
(none) β no parameters, bestie. Nothing to pass in, just vibes.
π Return value π
Maximum number of elements. That's the whole return value, no cap.
π¦ Complexity π¦
Constant. Lowkey the easiest complexity ever.
π₯ 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, max_size() is the theoretical dream, but your actual RAM is the vibe check π.
π Example π
// Run this code
#include <iostream>
#include <flat_map>
#include <locale>
int main()
{
std::flat_map<char, char> q;
std::cout.imbue(std::locale("en_US.UTF-8"));
std::cout << "Maximum size of a std::flat_map is " << q.max_size()
<< '\n';
}
π Possible output π
Maximum size of a std::flat_map is 768,614,336,404,564,650
π See also π
sizeβ returns the number of elements (public member function).
That's the whole page, bestie! Source/version/date: http://cppreference.com, 2024.06.10, page std::flat_map::max_size(3). Bye π
β¨
π¦ 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