How to serialize class derived from standard container?
This could be very stupid question but I am stuck with this situation. I
have class A derived from List<B> and B derived from C. How do I write
Serialize method for A? See below, both options I tried are not working.
Any help is appreciated. Thanks.
class B : public C
{
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(C);
}
};
class A : public list<B>
{
public:
void Append( const list<string>& rBList );
A::const_iterator FindSpecialB(const B& rB);
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(List<B>);
OR
ar & boost::serialization::make_nvp("AddressList",
boost::serialization::base_object(*this));
OR
??
}
};
participants (1)
-
Terdale, Shantibhushan