Please specify the range of vector list ....
I want to store million of records in vector<>.
I have to copy Millions of records from one vector<> to an
I test it in my pc. Windows 7 32bit.
The result is 2^32/sizeof(CPoint3D)-1=268435455
, sizeof(CPoint3D)
is 16.
But max_size
is nothing. After it, m_point1.reserve(25641355)
, "Out of Memory" is showed.
25641355 < 268435455
What is the maximum size of an vector ....
I think you have answered your own question.
Theoretical limit for your system you can get with a function vector<T>::max_size()
. For instance:
vector<int> vec;
std::cout<<vec.max_size()<<std::endl;//prints max size for vector<int> in your system!
So just run this and check out the answer for your system.
However in practice the vector's allocated array must be in one consecutive memory block and even with less size memory allocation can fail. If you are going to use vector of ints with million elements I think you shouldn't have any problems. However for bigger objects it can be problematic.
There's no limit except the available memory. But: a vector requires all the memory to be in one consecutive memory area. If you want to store a million records, there might not be such a big memory area available.
In that case, it's better to use a deque
instead of a vector
.