Boost logo

Boost :

Subject: Re: [boost] [boost.Serialization V1.42.0] Question aboutBOOST_SERIALIZATION_SPLIT_FREE and non-public members
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-08-09 23:11:18


AMDG

OvermindDL1 wrote:
> On Mon, Aug 9, 2010 at 7:43 PM, gmkdroid <gmkdroid_at_[hidden]> wrote:
>
>> Here's an example of the issue I'm having:
>>
>> *MyObject.h*
>>
>> //////////////////////////////////////////////////////////////////////////////////////
>> #include <boost/serialization/access.hpp>
>> class CMyObject
>> {
>> public:
>> friend class boost::serialization::access;
>> CMyObject(void) : m_nPrivateData(123) { }
>> ~CMyObject(void) { }
>> private:
>> int m_nPrivateData;
>> };
>>
>
> Your friend class boost::serialization::access; is in the public
> section, put it in the private section then it can access the private
> data.
>

public vs. private doesn't affect friend declarations.

In Christ,
Steven Watanabe


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