Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2004-08-30 07:33:05

Apart from some broken links and typos in the documentation/comments,
I am very impressed by the amount of work and profesional setup
of the documentation and the over all design. This looks like
it is a graduation project for a university or something (and
perhaps it is).

The only thing that really bothers me is that it seems not
possible to replace std::streambuf being used by the library
(ie streambuf_facade) with a custom streambuf implementation
(also derived from std::streambuf of course). I'd have use
for that because very likely I'd want to use my own, optimized
streambuf (one that adds an interface to be able to read/write
to it in a way that there is hardly ever need to actually
_copy_ data, see

Another thing that is bothering me is that the whole
presence of anyting 'stream-like' (ostream/istream) seems
not in the right place here. This is not only because
the std::ostream/std::istream class are merely 'hooks' to
hook into the operator<< and operator>> functions which
are primarily intended for text (human readable representations)
while this library is about binary data - but more importantly
because everything this library does is related to and at the
level of streambuf's (which DO have a binary interface)
This fact is most apparent by considering the fact that this
code should work:

filtered_ostream fout;

std::ostream& out(fout); // Only have/use the std::ostream base class.
out << "Hello World"; // This must use the filter.

A much more logical API would therefore be:

filtered_streambuf fbuf;

std::streambuf& buf(fbuf);

And then using 'buf' as streambuf for some ostream of operator<< inserters
are desirable.

To summarize:

- I think that the stream interface should be ripped out and replaced
  by one that is an equivalent streambuf. Providing a stream interface
  should be merely a 'convenience' interface and not the main API.

- This streambuf interface should use a 'Streambuf' template parameter
  for its base class that only defaults to std::streambuf (and may demand
  that it is derived from std::streambuf if that is really necessary) but
  allows the base class to be replaced with a custom implementation.

Carlo Wood <carlo_at_[hidden]>

Boost list run by bdawes at, gregod at, cpdaniel at, john at