Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization - newbie] serializing/deserializing singleton class objects
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2009-08-12 10:46:26


Soumen wrote:
[snip]
>
> D::cleanup();
> D *dObj = D::instance();
> iparchive >> (*dObj);
>
[snip]

I am also trying to do serialization of singletons (see post regarding
serialization and error category). Have you considered using the stuff
available for "non-default constructors" (see doc) for loading? E.g.,

template<class Archive>
inline void load_construct_data( Archive & ar, D * dObj, const unsigned int
file_version ){
    dObj = D::instance();
}

Cheers,

Rutger


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