Boost logo

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 03:08:54


Robert Ramey wrote:
> 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
>

whoops, spoke too soon, I added the following to make sure things
were instantiated.

#include <fstream>
int
main(int argc, char *argv[]){
std::ifstream is;
boost::archive::xml_iarchive ia(is);
CMyObject obj;
ia >> BOOST_SERIALIZATION_NVP(obj);
}

and I got your error. I'll look at it

Robert Ramey


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