Re:[boost] Re: Formal review: serialization

Jeff F wrote:
template<class Archive> inline void serialize( Archive& ar , boost::filesystem::path& t , unsigned int version ) { std::string lPathString;
if( is_saving(ar) ) lPathString = t.native_file_string();
ar & make_nvp( "PathString", lPathString );
if( is_loading(ar) ) t = boost::filesystem::path( lPathString, boost::filesystem::native ); }
The "real" solution here is to implement serialization for "native_file_string() So that things look like template<class Archive> void serialize( Archive &ar, boost::filesystem::native_files_sting_type & t, unsigned int version ){ ... ?; } template<class Archive> void serialize( Archive &ar, boost::filesystem::path & t, unsigned int version ){ ar & make_nvp("PathString", t); } Robert Ramey
participants (1)
-
Robert Ramey