Boost logo

Boost :

From: Jonathan D. Turkanis (technews_at_[hidden])
Date: 2003-06-10 17:56:14


Robert Ramey wrote:
>In the course of my work I had occasion to make a small family
>of iterator adaptors for escaping/unescaping ascii text, and things
>like that. I made the constuction interface so it could use
>another iterator adaptor as a "source" thereby permiting me
>to compose iterators in any sequence (sort of like unix pipes).
> If there is any interest I will post this.

> I wonder if one can't make a code_cvt facet
>that would be constructed with an arbitray iterator adaptor.

Sure, I would like to take a look at your adaptors. I've thought a little
more about composition, and I think I see what your getting at. Composing
streambufs is easy if the conversion facilities you want to use are
expressed as codecvts. A wrapper around the code I posted could be used to
generate streambufs like so:

template<typename Codecvt, typename SrcOrSink>
struct compose { }; // Derives from basic_streambuf<.., ..>

You could then chain this operation: compose<Compress, compose<Escape,
compose<Decrypt, File> > >. But the interface of std::codevt is complicated
by the need to make the member functions const and pass the state as an
argument, by the return codes, etc. If a simpler interfaces suffices most of
the time this would be nice.

I'm interested to see the interface of your iterator adaptors; particularly
how general it is.

Jonathan Turkanis


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