#include #include #include #include #include #include /* conventional user-defined type */ struct udt { udt(int x=0):x(x){} int x; /* These two operators are defined due to a bug in * MSVC++ 6.0 STL. Please ignore them. */ friend bool operator==(const udt&,const udt&); friend bool operator< (const udt&,const udt&); private: friend class boost::serialization::access; template void serialize(Archive &ar,const unsigned int) { ar&x; } }; struct foo { std::list cont; udt* pos; private: friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int) { ar&cont; // before pos, as you suggest ar&pos; } }; int main() { foo f; f.cont.push_back(1); f.pos=&(*f.cont.begin()); // pos points to an element of const std::cout<<"cont.begin(): "<x<x<>f2; /* surprise! */ std::cout<<"cont.begin(): "<x<x<