|
Boost Users : |
From: Chad Walters (chad_at_[hidden])
Date: 2007-05-29 21:10:14
Standard stream and stream buffers are supposed to be models of the Device
concept (http://www.boost.org/libs/iostreams/doc/concepts/device.html).
However, I am finding that their treatment by various parts of the library
doesn't seem to be consistent. For example, streams don't actually seem to
be usable everywhere a Device can be used.
For example, if I define SinkOrStream as follows:
using namespace boost::iostreams;
typedef file_sink SinkOrStream;
Then the following declarations compile properly:
SinkOrStream mySink(mFileName);
stream<composite<gzip_compressor, SinkOrStream> > out1(gzip_compressor(),
mySink);
stream<SinkOrStream> out2(mFileName);
However, neither out1 nor out2 compile properly if I define SinkOrStream as:
typedef stream<file_sink> SinkOrStream;
If I understand the documentation correctly, these should both be legal, no?
Does this work for others?
I also find it a little strange that streams are supposed to be models of
Device and they have a close() method, yet they do not support the
closable_tag. Is this by design?
Thanks for any help on clarifying these issues...
Chad Walters
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net