
Have you included #include <boost/serialization/string.hpp> ? Michael Sperber wrote:
Hi there,
I'm trying to convert a piece of code from templated archives to polymorphic ones, and am running into trouble when serializing std::string. Either I get an error message saying that std::string has no serialize member function, or I get the attached message.
The relevant code is this:
---snip--- #include <boost/serialization/serialization.hpp>
#include <boost/archive/polymorphic_iarchive.hpp> #include <boost/archive/polymorphic_oarchive.hpp>
void mtime::serialize(boost::archive::polymorphic_iarchive& ar, const unsigned int file_version) { std::string iso; ar & boost::serialization::make_nvp("iso_time", iso); set_from_iso_string(iso); }
void mtime::serialize(boost::archive::polymorphic_oarchive& ar, const unsigned int file_version) { std::string iso =3D to_iso_string(); ar & boost::serialization::make_nvp("iso_time", iso); } ---snip---
Am I missing something obvious? Are certain types not directly supported for serialization via polymorphic archives? Any help would be much appreciated.