Re: [Boost-users] [Serialization] [Ptr_container] Serializing a boost::ptr_vector fails

I'm sorry, I simply forgot to
#include
Dear list,
I want to use boost::ptr_vector<> in conjunction with boost::serialization. The ptr_cotainer documentation says:
As of version 1.34.0 of Boost, the library supports serialization via Boost.Serialization. Of course, for serialization to work it is required that the stored type itself is serializable. For maps, both the key type and the mapped type must be serializable.
However, when I create a class like this:
#include
#include class Foo { boost::ptr_vector<int> the_vector_ friend class boost::serialization::access;
template<class Archive> void serialize(Archive & ar, const unsigned int) { ar & the_vector_; } }
and then try to serialize it:
std::ofstream ofs("filename"); Foo f; boost::archive::text_oarchive oa(ofs); oa << f;
I'm getting the following error, using gcc 4.2.1 and boost 1.46.1:
/usr/local/include/boost/serialization/access.hpp:118: error: 'class boost::ptr_vector
>' has no member named 'serialize' How can I serialize a boost::ptr_container ?
Regards, Philipp
participants (1)
-
Philipp Münzel