|
Boost : |
Subject: Re: [boost] patch to serialize mersenne_twister
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-10-30 07:25:35
Robert Ramey wrote:
> Neal Becker wrote:
>>> Since it wants private access into the class, how would you package
>> it as a separate header?
>
> add "friend class boost::serialization::access;" to the class declaration.
>
> Robert Ramey
>
I don't see how that works. If I add
friend class boost::serialization::access;
inside of the original class declaration, and then outside the class declaration:
typedef boost::mt19937 rng_t;
namespace boost { namespace serialization {
// Serialization
template<class Archive>
void serialize(Archive & ar, rng &m, const unsigned int /* file_version */){
ar & serialization::make_nvp ("i", m.i);
ar & serialization::make_nvp ("x", m.x);
}
}}
This doesn't compile:
/usr/local/src/boost.hg/boost/random/mersenne_twister.hpp:209: error: 'int boost::random::mersenne_twister<unsigned int, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18, 3346425566u>::i' is private
mod/boost_rand.cc:49: error: within this context
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk