
Nicolas Guillot wrote:
Robert Ramey <ramey <at> rrsd.com> writes: One question remains: how to deserialize onto an already instantiated object?
serialization is always done into an already instantiated object. For pointers, there is a preliminary step of creating a new object, but after that its the same always. Or: how to implement the Load function better than:
template<class T> void FileLoad(const std::string & path, T & t){ std::ifstream ifs(path.c_str()); T* p; ia >> p; t = *p; delete p; }
use:: template<class T> void FileLoad(const std::string & path, T & t){ std::ifstream ifs(path.c_str()); boost::text_iarchive ia(ifs); ia >> t; } which will run a maximum possible efficiency and will be exception safe. Robert Ramey