Does Boost Ranges have a built-in way to cout the elements easily, for example separated by comma or space?
I am of course aware that I could loop over them and print them separately, but it seems to me that this should be built in somehow (like printing a vector in scripting languages).
In an example program I saw, the author copied the range to cout:
boost::copy(range, ostream_iterator(cout, " "))
Looks ugly to me. Is this idiomatic?
EDIT: A solution for std iterators would also be acceptable.
EDIT2: What I want to do is this:
cout << range;
But I don't think that works. So what I am hoping for is something like this (Python inspired):
cout << range.join(", ");
or perhaps with a range adaptor.
cout << (range | stringify(", "));