#include #include #include #include #include template class Algo { friend class boost::serialization::access; template void serialize(Archiv& ar, unsigned const version) { } }; template class Status { friend class boost::serialization::access; template void serialize(Archiv& ar, unsigned const version) { } }; template class DerivedStatus : public Status { friend class boost::serialization::access; template void serialize(Archiv& ar, unsigned const version) { ar & boost::serialization::base_object >(*this); } public: DerivedStatus() : Status() { } }; // Doesn't work (wrong number of macro arguments ): // BOOST_CLASS_EXPORT( DerivedStatus< Algo< int, double > > ); // Doesn't work (invalid template parameter): // BOOST_CLASS_EXPORT( (DerivedStatus< Algo< int, double > >) ); // - Used to work with serialization20.zip (but is impractical with an // unknown number of specializations) // - fails with Boost CVS as of 2004-08-12: namespace { typedef DerivedStatus< Algo< int, double > > DerivedStatus_Algo_int_double; }; BOOST_CLASS_EXPORT_GUID(DerivedStatus_Algo_int_double, "DerivedStatus_Algo_int_double"); int main() { Status< Algo< int, double > >* p_s = new DerivedStatus< Algo< int, double > >; boost::archive::text_oarchive oa(std::cout); oa << p_s; }