Hi,
can someone tell me if the behaviour of the enclosed example is a bug?
In my test, the last two assertions fail, but I don't understand why
(Boost 1.42.0).
Thanks,
Nicola
#include
#include
#include
#include <cassert>
#include <fstream>
#include <sstream>
struct bz2istream :
public boost::iostreams::filtering_streamboost::iostreams::input
{
public:
bz2istream(std::string const& path) :
pBz2file(path.c_str(), std::ios_base::in | std::ios_base::binary)
{
push(boost::iostreams::bzip2_decompressor());
push(pBz2file);
}
private:
std::ifstream pBz2file;
};
int main() {
bz2istream bzippedfile("foo.bz2");
std::ostringstream os;
boost::iostreams::copy(bzippedfile, os);
assert(!(bzippedfile.rdstate() & std::ios_base::goodbit)); // Ok
assert(bzippedfile.rdstate() & std::ios_base::eofbit); // Fails
assert(!(bzippedfile.good())); // Fails
}