[Serialization] This compiles; but does it work?
mGraphFile is a data member of type boost:filesystem::path, which isn't (as I understand) handled natively by Boost Serialization. I could define template<class Archive> void serialize(Archive& ar, boost::filesystem::path& p, const unsigned int version); but it is needed in only one place. Below is an excerpt from an inline serialization function that I'm already using. While it has a redundant step not needed for loading and a different redundant step not needed for storing, it would seem to do what I need. (The minor inefficiency of the redundant statements is of no concern here.) ... std::string str = mGraphFile.string(); // redundant if loading ar & BOOST_SERIALIZATION_NVP(str); mGraphFile = str; // redundant if saving ... Can anyone tell me if this will work, or do I need to implement the serialize() function? Merrill Cornish
participants (1)
-
Merrill Cornish