I was using the std::stream_iterator, for example:

It has the “,” after the last item.

So here’s an implementation that doesn’t append the seperator after the last one:

And here’s the corresponding code to use it: