Here is a program that derives from ostream_iterator and implements the fix, so that you can use the standard algos. just as they are.

-- begin code --

#include
#include
#include

using namespace std;

template
class my_ostream_iterator
: public std::ostream_iterator
{
bool first;
std::string delim;
std::ostream &_out;

public:

template
my_ostream_iterator(OutType &_o, std::string const &_d)
: std::ostream_iterator(_o, ""), first(true), delim(_d), _out(_o)
{ }


my_ostream_iterator &
operator*()
{
// cerr


Gravatar Dhruv, I apologise -- my comment system makes it almost impossible to include a code listing. I'd be very interested to see the code you intended to post. Would you be able to email a copy to tag@wordaligned.org, or provide a link to it?

I'd like to revisit this article and make some minor tweaks myself, but your code looks much more interesting.


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan