Richard Jennings wrote:
I have found that the requirement that no serialization headers can be included before any archive headers means that you have to be careful which serialization headers you include in your class headers and indeed in what order you include them.
It is my intention that this issue be addressed with the simple rule: "all headers from the serialization directory should follow and headers from the archive directory" I believe that this rule should be very easy to follow. As a beneficial side-effect of flagging any usage of "archive" headers in include modules for classes. This would accidently link a serialization definition with implementation of a specific archive.
In particular if you include serialization/nvp.hpp before serialization/vector.hpp and you use that class in another module that does not use archiving at all then that module will hit the error directive, example below.
This would surprise me. Your example looks good to me. So I built on my own machine. Both main.cpp and B.cpp compiled without problems with VC 7.1 . So we're out of sync somehow.
A solution would seem to be that serialization/nvp.hpp should only be included in the module that includes archive headers.
This wouldn't work and shouldn't be necessary. Lets beat upon your example some more until we get the same results.
I guess what I would like is some guidance on using serialization as it's become a bit more tricky in my experience.
I would hope that its not too tricky. The system is designed to be as tricky as necessary - but no trickier.
At least you can't willy-nilly include serialization headers in any order in any headers and expect the application to compile.
True
Perhaps it only worked by luck before!
LOL - well I do consider myself a lucky person !!! But
A very small observation on your code:
#include <vector> // note this is superflous - but harmless
#include