From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2000-11-17 15:55:24
Asger Alstrup Nielsen wrote:
> > - I think that the "buffer" layer can be removed entirely.
> > I believe the correct way is to write a streambuf for C files
> > and fixed-size memory areas. (std::stringstream is close (but
> > not fixed-size) to a memory area, btw.)
> Could you elaborate on this idea a bit more?
> I certainly agree that the buffer layer is poorly documented, and it
> should be great to clean this area up, since it's the weakest point of
> the concept as I see it.
I am suggesting to use the C++ Standard iostreams interface
instead of the buffer layer. It already has all the required
functions: Pushing some data into it, flushing it to disk, advanced
caching is possible, reading enough data from the disk on-demand etc.
And it re-uses a standard component instead of re-inventing I/O.
However, the current iostreams only cover one of the three buffer
alternatives for XTL: iostream. The C++ iostreams library is
extensible, though, so you can write your own specialized C++ stream
which handles the "cfile_buffer" and "mem_buffer" cases. The proper
way to do that is to write your own streambuf. For cfile_buffer,
one could argue that C-style FILE*'s have been superseded by C++
iostreams anyway, so a replacement is not required. For mem_buffer,
as said before, stringstream goes a long way (including automatic
Please ask if I'm still not making sense to you :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk