Why is it workable? There are two different strings "testString" but the vector size is allocated correctly.
#include <iostream>
#include <vector>
#include <iterator>
int main()
{
    std::vector<char> str;
    str.assign(std::begin("testString"), std::end("testString"));
    copy(str.begin(), str.end(), std::ostream_iterator<char>(std::cout, " "));
    std::cout<<str.size();
    return 1;
}
 
     
     
     
     
    