Boost logo

Boost :

From: mfdylan (dylan_at_[hidden])
Date: 2001-12-20 22:13:45


--- In boost_at_y..., Ross Smith <r-smith_at_i...> wrote:
> bill_kempf wrote:
> >
> > --- In boost_at_y..., Ross Smith <r-smith_at_i...> wrote:
> >
> > > Iostreams are a disaster area; they violate the "you don't pay
for
> > what
> > > you don't use" rule right left and centre. Let's not throw good
code
> > > after bad, please.
> >
> > This is only true if a basic_binary_istream were derived from
> > std::basic_istream, which is going to be nearly impossible to do
any
> > way. However, borrowing the design and making use of streambufs
can
> > make the design much more powerful, extendible and interoperable
with
> > existing code, and really shouldn't cause much (any?) overhead.
>
> Fair enough; if you can come up with a binary I/O library that
doesn't
> derive from standard iostreams (while still using standard
streambufs)
> and doesn't bring locales in, I'll withdraw my objections. But I
don't
> entirely think it's reasonable to call it a "binary iostream"; to
me the
> term "I/O streams" necessarily implies something derived from
standard
> iostreams, and that's what I've been assuming so far.
>
> If someone writes such a class that would be great (I don't know
enough
> about the arcane details of streambufs to attempt it myself), but I
> don't think its name should include the word "stream", to avoid
> misleading people into thinking it's an iostream in the C++ standard
> sense.
>
Look at the one I put in files (under socketbuf.zip), it doesn't
involve locales or iostreams at all, in fact it doesn't even derive
from ios, which there might be a some reasonable argument for.
All it does is make use of the standardised streambuf interface (in
fact the only functions it uses are sputn(), sgetn() and sync()).
It *is* a stream however, and it would be misleading to call it
anything else. I think binary_stream as opposed to binary_iostream
works as a name - the interface is largely the same as std::iostream,
and conceptually they are both streams, but it doesn't make any claim
to *be* a std::iostream.

Dylan


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