#include <iostream>
#include <vector>
#include <iterator>
#include <sstream>
using namespace std;
vector<int> numbs = {1, 2, 3, 4, 5};
ostream_iterator<int, char> iter (cout, "; ");
copy(numbs.begin(), numbs.end(), iter);
//printed: "1; 2; 3; 4; 5;"
cout << endl;
stringstream stream;
iter = ostream_iterator<int, char>(stream, "-");
copy(numbs.begin(), numbs.end(), iter);
string str = stream.str();
//str is "1-2-3-4-5-"
cout << "str is '" << str << "'";