|
Boost Users : |
From: Matthias Troyer (troyer_at_[hidden])
Date: 2008-05-15 13:31:30
On 14 May 2008, at 22:17, Victor Whiskey Yankee wrote:
>
> Could you just post it to the list?
Here is an example program:
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/iostreams/stream_buffer.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/serialization/vector.hpp>
#include <vector>
#include <iostream>
int main()
{
namespace io = boost::iostreams;
typedef std::vector<char> buffer_type;
buffer_type buffer;
const std::vector<double> data(10000000);
io::stream<io::back_insert_device<buffer_type> >
output_stream(buffer);
boost::archive::binary_oarchive oa(output_stream);
oa << data;
output_stream.flush();
std::vector<double> data_in;
io::basic_array_source<char> source(&buffer[0],buffer.size());
io::stream<io::basic_array_source <char> > input_stream(source);
boost::archive::binary_iarchive ia(input_stream);
ia >> data_in;
}
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