What is maximum size of std::size and std::map? And is there a way to increase this number?
Thanks!
You can get maximum size of every standard library container by calling Container::max_size() on it. If you need theoretical maximum size value at compile time, use std::numeric_limits<Container::size_type>::max().
Maximum size of any standard container is given by container<T>::max_size() method. In general case, this size might (and will) be smaller than the range of container<T>::size_type.
The range of container::size_type can be obtained through std::numeric_limits, but, again, keep in mind that containers do not guarantee that their maximum size can reach the full range of their size_type.
Note also that container<T>::max_size() returns the maximum number of elements in the container, while std::numeric_limits<container<T>::size_type>::max() returns the range of the size_type. These are incomparable values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With