Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12945: boost::iostreams filtering streambufs only work with binary archive
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-05-03 22:17:58
#12945: boost::iostreams filtering streambufs only work with binary archive
-------------------------------+---------------------------
Reporter: fiesh@⦠| Owner: ramey
Type: Feature Requests | Status: closed
Milestone: To Be Determined | Component: serialization
Version: Boost 1.62.0 | Severity: Problem
Resolution: invalid | Keywords:
-------------------------------+---------------------------
Changes (by ramey):
* status: new => closed
* resolution: => invalid
Comment:
for text files use filtering_ostream rather than filtering_ostreambuf .
text files must use streams. binary files may use streams or streambuf
{{{
#include <iostream>
#include <sstream>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/serialization/vector.hpp>
int main()
{
const std::vector<int> v{0, 1, 2};
std::stringstream ss;
{
boost::iostreams::filtering_ostream o;
o.push(boost::iostreams::gzip_decompressor());
o.push(ss);
// filtering_ostreambuf isn't accepted by text_oarchive's
ctor, only by binary_oarchive
// So this doesn't work
boost::archive::text_oarchive oa(o);
// But this does
// boost::archive::binary_oarchive oa(o);
oa << v;
}
std::cout << ss.str() << '\n';
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12945#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-05-03 22:27:12 UTC