Reputation: 25
As we can store 10^7 elements in array,if we are required to store the elements >= 10^9 then how can we do that?
Upvotes: 2
Views: 1265
Reputation: 238311
Max no. of elements that can be stored in the std::vector
Depends on the limitations of the system that runs the program. On a 64 bit system, the maximum is most likely limited by the amount of physical memory your system has available.
if we are required to store the elements >= 10^9 then how can we do that?
Then call vec.resize(1'000'000'000)
. That's less than 4 gigabytes of memory (on typical systems).
Upvotes: 7