To initialize variables for a certain computation I have to assign them values from an integer array. So I do:
vector<double> vd;
int ai[N]; // Filled somewhere else
vd.assign(ai, ai+N);
This works under gcc 4.6.1 Linux. But is it always correct? Or should I return to the evergreen:
vd.resize(N);
for(int i=0; i < N; ++i) vd[i] = (double)ai[i];
Thanks for clarifying!