我正在尝试将数组复制到向量。
int A[1000]; //This array is filled by some function
vector<int> vec;
//some position from which I want to write the contents of the array into vector
int x = some_position;
vec.resize(sizeof(A)+x);
vec.insert(vec.begin()+x, A, A+sizeof(A));
问题是每四个元素都没有正确复制。其余元素被正确复制。即 vec[x+3] != A[x+3] for x=0,1,2,3....