int nums[] = {100, 200, 300, 400, 500, 600};
vector<int> vec;
vector<int>::iterator it;
//方法一
// vec.resize(6); // 为容器myvector分配空间
// copy (nums, nums+7, vec.begin());
//方法二
copy (nums, nums+6, std::back_inserter(vec));
cout << "vec contains: ";
for ( it = vec.begin(); it != vec.end(); ++it )
{
cout << " " << *it;
}
cout << endl;

这个也是很好的方案 std::back_inserter