#include #include #include class TestSerialize { public: std::string test_; TestSerialize() {} ~TestSerialize() {} bool save( const std::string filename ) const { std::ofstream ofs( filename.c_str() ); if( ofs.good() ) { boost::archive::xml_oarchive oa( ofs ); oa << boost::serialization::make_nvp( "TestSerialization", *this ); } } bool restore( const std::string filename ) { std::ifstream ifs( filename.c_str() ); if( ifs.good() ) { boost::archive::xml_iarchive ia( ifs ); ia >> boost::serialization::make_nvp( "TestSerialization", *this ); } } }; namespace boost { namespace serialization { template void serialize(Archive & ar, TestSerialize & d, const unsigned int version ) { ar & BOOST_SERIALIZATION_NVP( d.test_ ); } } }