|
Boost Users : |
From: Loïc Joly (loic.joly_at_[hidden])
Date: 2007-05-02 07:11:50
I know from the doc that the way to deal with non default constuctors
for deserialization is the load_construct_data function.
However, I'm in a case where the parameters of the non default
constructor are not serializable, but can be provided at runtime. How
can I pass those values to load_construct_data ?
One example to be clearer:
class Data
{
public:
Data(Mutex &m) :
myMutex (m)
{}
private:
friend class boost::serialization::access;
Mutex &myMutex; // Mutex is intrinsically a non serializable info
template<class Archive>
void serialize(Archive &ar, const unsigned int file_version){
}
};
int main()
{
vector<Data> v;
Mutex mutexForData = createMutex();
std::ifstream ifs("filename", std::ios::binary);
boost::archive::text_iarchive ia(ifs);
ia >> v; // I'd like Data in the vector to use my mutexForData mutex
}
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