Z
zl2k
hi, all
I am using a 2 dimensioanl array implemented by vector<vector<long> >.
When the row number grows to 8 and I am trying to insert a new row, I
got the segmentation error. However, if I reserve the row number to 16
(in my case the size of row will always less than 16) at the very
begining, then everything works well. (The column number could be quite
large.)
What is the problem? The vector can automatically grow as needed,
right? (actually, I do see it grow from 0, 1, 2, 4 and 8) Then why it
causes the segmentation error?
I am using a 2 dimensioanl array implemented by vector<vector<long> >.
When the row number grows to 8 and I am trying to insert a new row, I
got the segmentation error. However, if I reserve the row number to 16
(in my case the size of row will always less than 16) at the very
begining, then everything works well. (The column number could be quite
large.)
What is the problem? The vector can automatically grow as needed,
right? (actually, I do see it grow from 0, 1, 2, 4 and 8) Then why it
causes the segmentation error?