Boost logo

Boost :

From: George M. Garner Jr. (gmgarner_at_[hidden])
Date: 2004-09-09 16:20:09


Johnathan,

Funny. It works if I templatize line_wrapping_output_filter like so:

template<class CHAR_TYPE>
class line_wrapping_output_filter : public output_filter
{
public:
typedef CHAR_TYPE char_type;
explicit line_wrapping_output_filter(int line_length = 80)
: line_length_(line_length), col_no_(0) { }
template<typename Sink>
void put(Sink& dest, int c)
{
if (c == char_type('\n'))
col_no_ = 0 ;
else {
if (col_no_ >= line_length_)
this->put(dest, char_type('\n'));
++col_no_ ;
}
boost::io::put(dest, c);
}
template<typename Sink>
void close(Sink& dest) { boost::io::put(dest, char_type('\n')); col_no_ =
0; }
private:
int line_length_ ;
int col_no_;
};

Regards,

George.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk