Sign in to follow this  

More problems with boost again...

Recommended Posts

OK, in my other post where I when on about not being able to serialize char*, I gave up and used std::string (I'm sure there's a way to a support for char*). Anyway I am having problems with splitting intrusive serialize methods when using STL containers in MSVC++ 7.1 look at ... class P { private: int qw; friend class boost::serialization::access; template<class Archive> void serialize(Archive& ar, const unsigned int version) { ar & qw; } public: P() : qw(0) {} P(int Qw) : qw(Qw) {} }; typedef std::list<P*> pList; class Test { pList p; friend class boost::serialization::access; BOOST_SERIALIZATION_SPLIT_MEMBER() template<class Archive> void load(Archive& ar, const unsigned int version) { ar & p; } template<class Archive> void save(Archive& ar, const unsigned int version) const { ar & p; } public: Test() {} }; If anyone tries to write this to an archive using something like ... Test t; std::ofstream ofs("frameTest"); boost::archive::text_oarchive oa(ofs); oa << t; ofs.close(); then I get .\boost_1_32_0\boost\serialization\split_free.hpp(45): error C2780: 'void boost::archive::save(Archive &,const T &)' : expects 2 arguments - 3 provided Now if I remove the load/save spliting and use a normal serialize method, this compiles fine. However I need separated load/save methods as the class I am using this on deals with SDL resources / structures. As a result I need to make it so my load method does special things to load surfaces for a little arcade game I'm working on. Could someone confirm this is a bug / issue with boost and not something dumb I'm missing out on. I've only been coding in C++ for the last month, and come from a PHP / Web programming background, so I'm still getting used to the change.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this