After I cleared the first vector and copy the second in it there still some characters left behind after copying.
How is that possible?
Code:#include <string> #include <vector> #include <iostream> using namespace std; int main() { string str = "Hello"; vector<char> v(11, '8'); vector<char> v2; for(int i = 0; i < 5; ++i) v2.push_back(str[i]); v.clear(); v = v2; cout << "v: " << &v.at(0)<< "\n\n"; }