
Hi! About the boost::serialization library, what is the best way to handle dynamic data in classes? Any idéas, suggestions or caveats? I didn't manage to find anything about this in the docs. Consider the following sample class: struct Dyn { Dyn(int s) : data(0), size(s) { data = new char[size]; } ~Dyn() { delete data; } char* data; int size; private: friend class boost::serialization::access; template< class Archive > void serialize( Archive &ar, unsigned int ver ) { // -> ar & data; What to do here? ar & size; } }; What to do with the data pointer? Is there any way to determine (in the serialize function) if a serialization or "de-serialization" is taking place? And have different behaviours - either allocating a new char[x] or copying data to the archive? Is there any way to store dynamic data in an archive? Best regards, Anders Sundman