Boost logo

Boost Users :

From: Lucas Meijer (lucas_at_[hidden])
Date: 2005-10-21 06:20:19


Hey,

I've been banging my head against the wall for hours on this one.
I'd like to serialize stl containers to an archive. Starting simple: a
vector<int>

This is what I think I should do:

1) include the proper support header file for the to be serialized
container.

#include <boost/serialization/vector.hpp>

2) create an archive, can be any type:

std::stringstream ss;
boost::archive::text_oarchive oa(ss);

3) operator<< my container into this archive:

const vector<int> myvec;
oa << myvec;

The "oa << myvec" generates lots of warnings, and when running it
anyway, it crashes in smart_cast.hpp

I've tried lots of containertypes, and creating them in other ways than
shown above, using a binary_oarchive, but it doesn't seem to make a
difference.

(int myint; oa << myint; works fine)

Does anybody see what I'm missing here?

Thanks, Lucas


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