I spent a few hours beating my head against a particular problem until the solution became clear, and I'd like to save the next guy the same time. In particular, I was trying to serialize something like the following structure:
std::map< int, std::shared_ptr< MySubclass > > myMap;
and I kept getting the following error:
cereal could not find any output serialization functions for the provided type and archive combination.
A serialization function existed and was working for MySubclass, so I couldn't see what all the fuss was about.
The actual source of the error, however, was that I had apparently failed to include cereal/types/polymorphic.hpp, and so myMap could not work out a specialization for MySubclass.
It would be helpful to both amend the documentation and the warning message to indicate that polymorphic.hpp needs to be included any time you serialize a derived class stored within a shared_ptr, regardless of whether or not there are multiple dependent serialized classes.
I spent a few hours beating my head against a particular problem until the solution became clear, and I'd like to save the next guy the same time. In particular, I was trying to serialize something like the following structure:
and I kept getting the following error:
A serialization function existed and was working for MySubclass, so I couldn't see what all the fuss was about.
The actual source of the error, however, was that I had apparently failed to include cereal/types/polymorphic.hpp, and so myMap could not work out a specialization for MySubclass.
It would be helpful to both amend the documentation and the warning message to indicate that polymorphic.hpp needs to be included any time you serialize a derived class stored within a shared_ptr, regardless of whether or not there are multiple dependent serialized classes.