Daniel said:
I read up on streambuf's last night.
Just out if interest: where did you read up on them?
Although, your solution does work,
I think it is inappropriate. Stream Buffers are supposed to represent
buffering strategies for different kinds of streams, not conversion
strategies.
Stream buffers are intended to represent streams of characters.
When streaming characters, it is quite common to transform them
in some way. Actually, this is the basis of UNIX' approach to
filters. My code effectively just did the moral equivalent of
"tr 'A-Z,' 'a-z '" which is, IMO, an entirely appropriate use
of streams.
In fact, even at the very basis of file streams, (i.e. in the
class template 'std::basic_filebuf') a heavy conversion mechanism
is employed which converts bytes read from a file into characters
used within an application or vice versa. This uses 'std::codecvt'
facets and it would be an easy typing exercise to inject the
conversion I implemented in the stream buffer into a corresponding
facet.
Both of our codes encapsulated the complete solution.
Well, I somewhat disagree with this statement but then, the
problem was trivial enough that it may not be worth to encapsulate
the solution further than you did.