I got to find std::copy_n with a behavior like this:
stringstream ss;
ss.str("abcdefghij");
string str;
str.resize(10);
std::copy_n(istreambuf_iterator<char>(ss), 5, str.begin());
cout << str << endl;
std::copy_n(istreambuf_iterator<char>(ss), 5, str.begin());
cout << str << endl;
It seems that what I got printed is abcde\n efghij"
.
Is this the correct behavior of iterator related operations ?
Aucun commentaire:
Enregistrer un commentaire