I would like to output list of strings value to ostream.
I can declare and implement overloading function for this:
ostream& operator<< (ostream &out, const list<string> &in);
... and then write like
cout << value;
... but there are at least two possible ways to dump list of strings: one string per line or all strings in one line separated by spaces (or maybe other separator).
Is it possible to change dumping function behavior through stream controlling?
I would like to write something like:
list<string> lst;
...
cout << print_as_multiline() << lst;
... and:
list<string> lst;
...
cout << print_as_one_line() << set_separator (", ") << lst;