This function eliminats the need of passing explicit template parameters to std:: ostream_iterator, which makes the code fragile and hard to read.
I agree that having to pass a template parameter to std::ostream_iterator is annoying.
...
A better solution is to write a polymorphic version of ostream_iterator; that is, a version that's not a template, but which has a templated operator=, so that you can output any type using the iterator.
I suspect that it would be difficult to make a valid STL iterator like that. How would you define std::iterator_traits for it?
ostream_iterator already has "void" as its value_type, difference_type, pointer, and reference (and so do other standard output iterators like insert_iterator)... so there would be no difference between the standard version and the modified version in that regard. Regards, Nate