|
Boost Users : |
Subject: Re: [Boost-users] forward declared class serialization
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-01-09 12:30:26
Try:
class fd;
class base: class derived
{
.....
fd *ptr;
.....
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
ar & boost::serialization::base_object<derived>(*this);
ar & ptr;
ar & ps_core_;
}
}; //end of class base
"niranjan bangera" <niranjannina_at_[hidden]> wrote in message news:50a2f6f20901090427p235da33ej5af121893bd33552_at_mail.gmail.com...
hi all,
I am in learning stage of the boost serialization concept.
I have one small problem in my project again. Here i have to serialize a pointer of a forward declared class. i dont how to do this. Pls help me to do this. May be the solutuion is too tough, it seems to tough for me, coz i have less knowledge about the c++.
I am using,
Version:1.36.0
compiler: gnu-gcc-4.1.1-binutils-2.16.1/x86_64-pc-linux2.4/bin/g++
my code looks like.
class fd;
class base: class derived
{
.....
fd *ptr;
.....
};
i have done it like serialization method is
class fd;
class base: class derived
{
.....
fd *ptr;
.....
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version)
{
(void) file_version;
ar & ps_core_;
ar & boost::serialization::base_object<derived>(*this);
}
}; //end of class base
Thanks in advance, Thanks for your time.
Niranjan
------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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