|
Boost Users : |
Subject: Re: [Boost-users] Serialising templates with smart pointers....
From: Marcus MacWilliam (marcus.macwilliam_at_[hidden])
Date: 2013-08-07 11:11:32
I think my question is how do I add a serialize method to an
interface class, which will invoke the serialize method on the
derived sub-class.
class Interface {
public:
virtual void aVirtual() = 0;
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
call serialize on derived class
}
};
class Derived : Interface
virtual void aVirtual() { // Do something }
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & m_data;
}
};
-- Marcus A.T MacWilliam, Senior Software Engineer. 1Spatial Ltd. Tel: +44 (0)1223 420414, ext 2289, Mob: +44 (0)7803 706597. E-Mail: marcus.macwilliam_at_[hidden] Skype:marcus.macwilliam Tennyson House, 7 Cambridge Business Park, Cambridge, CB4 0WZ. Registered in England No. 4785688, VAT Reg. No. 135539408. Website: http://www.1spatial.com/ E-mail: info_at_[hidden]
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