I am trying to automate object serialization to the extent that C++ programmers would put a macro into each class they want to serialize and not do anything else. Much the same way as with the [serializable] attribute in C# or Serializable interface in Java. I have a preprocessor that generates template <class Archive> void serialize(Archive &s ... ) function for each class the programmer wants to serialize and I require the programmer to link against boost::serialization. Now with this char* I need a solution that would not require the objects A, B, C and so on to know about the file.ptr. In other words the generated serialize funcs for A, B, C ... should not include code that uses file.ptr This is actually why I need access to the internal IDs of objects that I was asking about in the other post with a subject: [serialization] how for a particular object to get ID that is assigned by the lib Ivan Robert Ramey wrote:
You could do the following:
a) serialize your gigantic character array. b) For each pointer you want to serialize serialize the displacement from the front of your array
save( ?; // save to huge array using binary object unsigned int disp; disp = A - file.ptr; ar << disp; disp = B - file.ptr; ... }
load( ?; // load huge array using binary object unsigned integer disp; ar >> disp a = file.ptr + disp; ar >> disp a = file.ptr + disp; ... }
Good Luck
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users