Use std::vector::max_size() function. Don’t confuse this function with std::vector::capacity() and std::vector::size() functions. vector::capacity() tells us when a vector will be reallocated and vector::size() tells us the count of elements inserted into a vector. Source code of vector::max_size looks like this… [sourcecode language=’cpp’]_SIZT max_size() const _THROW0() { // estimate maximum array size _SIZT _Count […]
Continue reading…