Boost logo

Boost Users :

Subject: [Boost-users] forward declared class serialization
From: niranjan bangera (niranjannina_at_[hidden])
Date: 2009-01-09 07:27:18


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 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