vector<int> vec;
boost::scoped_array<int> scpaInts;
scpaInts.reset(new int[10]);
for (int i=0; i<10; i++)
scpaInts[i] = i*2;
vec.assign(&scpaInts[0], &scpaInts[9]+1); // => method one
vec.assign(scpaInts.get(), scpaInts.get()+10); // => method two
Question 1> I have figured out two methods. But I am not sure whether they are correct or there is a better way to do this.
Question 2> Is it true that we cannot get the valid length from boost::scoped_array?
Thank you