Subject: [Boost-bugs] [Boost C++ Libraries] #12945: boost::iostreams filtering streambufs only work with binary archive
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-04-04 08:11:04
#12945: boost::iostreams filtering streambufs only work with binary archive
------------------------------+---------------------------
Reporter: fiesh@⦠| Owner: ramey
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.62.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------
Since there is no portable binary format, using the text archive and
gzipping it seems convenient. However, using boost::iostream's
filtering_streambuf only works with the binary archive, not the text
archive, which is somewhat surprising.
{{{#!cpp
#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_streambuf.hpp>
#include <boost/serialization/vector.hpp>
int main()
{
const std::vector<int> v{0, 1, 2};
std::stringstream ss;
{
boost::iostreams::filtering_ostreambuf 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> 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-04-04 08:14:37 UTC