So I'm trying to serialize a boost::filesystem::path. So I have:
ar(CEREAL_NVP(Filename));
that I use to serialize such a variable.
Then, inside an included header, I have
namespace cereal
{
std::string save_minimal(const cereal::XMLOutputArchive&, const boost::filesystem::path& Path);
}
Now, if I have this code, then cereal complains to me "
cereal found more than one compatible output serialization function for the provided type and archive combination."
So to troubleshoot, I tried commenting out that function. Then cereal tells me "
cereal could not find any output serialization functions for the provided type and archive combination."
This seems weird to me. The above is the only function that can serialize a boost::filesystem::path that I can see in the project (and yes, it's a minimal project to aid troubleshooting).
Maybe I'm doing something wrong here.
Also, regarding the above, for compile time's sake (seriously, compile times with cereal is ridiculously long), I tend to forward declare all serialization functions and define them in separate source files to cut down compile time. I'm not sure if this is the right way or not because the doc doesn't mention it at all. I typically do
namespace cereal
{
std::string save_minimal(const cereal::XMLOutputArchive&, const boost::filesystem::path& Path);
void load_minimal(const cereal::XMLInputArchive&, boost::filesystem::path& Path, const std::string& val);
}
Is this the right way of doing it? Should I be doing it in another way?