Jan Tinkhof wrote:
Hello all,
I'm currently trying to make a library serializable and would like to be as non-intrusive as possible.
Unfortunately this library (ODE) uses its own forms of linked lists to manage its objects and the links include a "pointer-to-pointer-to-type" (type**).
How do I go about serializing these? Why doesn't this compile?
#include <fstream> #include
struct mystruct { int i; };
template<class Archive> void serialize(Archive& ar, mystruct& ms, const unsigned int version) { ar & ms.i; } BOOST_CLASS_TRACKING(mystruct, boost::serialization::track_always)
int main( int argc, char* argv[], char* envp[] ) { std::ofstream ofilestream("filename.txt"); boost::archive::text_oarchive oarchive(ofilestream);
mystruct a; mystruct* pa = &a; // *** replace this // mystruct** ppa = &pa; // *** with this mysturct ** const ppa = &pa;
oarchive << ppa;
}
*** read the rationale section on why this trap occurs. Robert Ramey