|
Boost : |
Subject: Re: [boost] [boost.Serialization V1.42.0] QuestionaboutBOOST_SERIALIZATION_SPLIT_FREE and non-public members
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-10 02:49:50
gmkdroid wrote:
> On Fri, Aug 6, 2010 at 6:40 PM, Robert Ramey <ramey_at_[hidden]> wrote:
>
>> gmkdroid wrote:
I just compiled the code below - with my msvc 7.1 compiler without
problem. What compiler are you using?
Robert Ramey
//////////////////////////////////////////////////////////////////////////////////////
#include <boost/serialization/access.hpp>
class CMyObject
{
public:
friend class boost::serialization::access;
CMyObject(void) : m_nPrivateData(123) { }
~CMyObject(void) { }
private:
int m_nPrivateData;
};
//////////////////////////////////////////////////////////////////////////////////////
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/serialization/split_free.hpp>
BOOST_SERIALIZATION_SPLIT_FREE(CMyObject)
namespace boost { namespace serialization {
template<class Archive>
void save(Archive & ar, const CMyObject& t, unsigned int version)
{
ar << boost::serialization::make_nvp("CMyObject", t.m_nPrivateData);
}
template<class Archive>
void load(Archive & ar, CMyObject& t, unsigned int version)
{
ar >> boost::serialization::make_nvp("CMyObject", t.m_nPrivateData);
}
}} // boost and serialization namespaces
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk