Boost logo

Boost :

From: jason (jason_at_[hidden])
Date: 2005-03-26 20:50:56


I'm all new to C++, let alone Boost, so do excuse me if this is a dumb post,
I've only been using C++ for a few weeks now, and come froma web design
background.

Anyway, I am getting a

Error C2780 .\boost_1_32_0\boost\serialization\split_free.hpp(45): error
C2780: 'void boost::archive::save(Archive &,const T &)' : expects 2
arguments - 3 provided

message when I use STL containers in Boost and the
BOOST_SERIALIZATION_SPLIT_MEMBER() macro in my class. I have found when I
don't split the serialize method into load / save methods it works fine.
However, I need separate load / save methods as some of the members in my
class are not serializable (they are SDL resources, and therefore uploading
I need to do some other work to restore these members).

Here is a chunk of example code that fails...

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() {}
};

Using

Test t;
std::ofstream ofs("frameTest");
boost::archive::text_oarchive oa(ofs);
oa << t;
ofs.close();

creates this error. To me it seems like this might be a library issue.
However could someone point out what I am doing wrong if it is me, and if it
is a lib issue, could they hint /suggest some sort of cleanish workaround. I
am going to mess about and hack together a workaround by not splitting the
serialize method into load/save methods in the class affected for now,
however I'm sure other people on this list will be able to suggest better
solutions than mine.

And yes, I am including the list.hpp file incase anyone thinks I'm not
including it.

Jason.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk