#include <iostream>
#include <sstream>
#include <algorithm>
#include <iterator>
int main()
{
std::string str = "To be or not to be...", str2;
std::istringstream ist(str);
for (int i = 0; i < 2; i++)
{
std::copy(std::istream_iterator<char>(ist),
std::istream_iterator<char>(),
std::back_inserter(str2) );
ist.str(str);
}
std::cout << str2;
return 0;
}
Login in to like
Login in to comment