How can I use very long STL vectors? I need to write a code where I use the vector container to store a very large number of values, and I need to access the elements using . I am currently using , where i is an integer. How can do the same if I have more elements than the largest integers (which in my system is 2^31)? For example in the sample "code" below, how can access myvec if "i" is supposed to be larger than 2^31?
Thanks,
vector<double> myvec;
while (Not Full) // add elements until decides to stop
{
double x = some value; // here there is a function to compute x
myvec.push_back(x);
}
int size = myvec.size();
for (int i=0; i < size; ++i)
{
cout << myvec[i] << endl;
}