S
ShaunJ
I often need to output a list with a delimiter (such as a tab or a
comma) before the item rather than after (which is where the end-of-
line will go). ostream_iterator puts the delimiter after the item. Is
there a simple solution for creating an ostream_iterator that puts the
delimiter before the item?
If I do it in a for loop, it's easy, of course. But the function I'm
calling takes an output iterator parameter, and to use a for loop I
would have to store all the results in a list first, which would take
a bunch of memory and is totally unnecessary.
Thanks,
Shaun
comma) before the item rather than after (which is where the end-of-
line will go). ostream_iterator puts the delimiter after the item. Is
there a simple solution for creating an ostream_iterator that puts the
delimiter before the item?
If I do it in a for loop, it's easy, of course. But the function I'm
calling takes an output iterator parameter, and to use a for loop I
would have to store all the results in a list first, which would take
a bunch of memory and is totally unnecessary.
Thanks,
Shaun