Between vector assignment can not be used memcpy_s, it will lead to memory errors of the original variables (guess).
They could use recycled won assign assignment methods, methods assign higher efficiency.
static vector<string> vec_test(1000000, "无力的反垄断的积分辣豆腐"); int main() { vector<string> v1; vector<string> v2; vector<string> v3; int t1,t2; t1 = GetTickCount(); for (int i = 0; i < 1000000; ++i) { v1.push_back(vec_test[i]); } t2 = GetTickCount(); cout << t2 - t1 << endl; t1 = GetTickCount(); vector<string>::iterator itr; for (itr = vec_test.begin(); itr != vec_test.end(); ++itr) { v2.push_back(*itr); } t2 = GetTickCount(); cout << t2 - t1 << endl; t1 = GetTickCount(); v3.assign(vec_test.begin (), vec_test.end ()); t2 = GetTickCount(); cout << t2 - t1 << endl; }