Q
quat
Hi,
Is it not legal to access an element that has been reserved?
For example:
vector<int> x;
x.reserve(10);
x[0] = 1;
This is throwing an exception with VS 2005, but worked fine for VS 2002.
From what I understand, reserve allocated memory but does not adjust the
internal "size" member. So technically, I should be able to access the
elements?
Is it not legal to access an element that has been reserved?
For example:
vector<int> x;
x.reserve(10);
x[0] = 1;
This is throwing an exception with VS 2005, but worked fine for VS 2002.
From what I understand, reserve allocated memory but does not adjust the
internal "size" member. So technically, I should be able to access the
elements?