serialization problem with strings

I have a custom stream that I am adaptiing to, so I build oarchive and iarchive classes derived from boost::archive::detail::common_xarchive according to the documentation. I have a function that looks like the following to handle the specifics of loading and saving. template<class T> void load(T & t) { // load data... } This seems to work for everything except std::string's. I noticed it when writing out a std::map<std::string, std::string>. The map is handled properly by the boost/serialization/map.hpp routines, but the strings are sent to my load function instead of being handled by boost/serialization/string.hpp. Any insight in to what I could possibly be doing wrong would be greatly appreciated. -doug

std::strings are special in that they are considered primitives. If you look at ser../string.hpp you'll notice that the serialization code is commented out and that the serialization trait for the std::string class is set to "primitive". There is code that specifically handles std::string. The reason is that the std::string is used in the archive header and due to chicken and egg issues, I chose to make strings prmitives. Robert Ramey "Doug Henry" <brilligent@gmail.com> wrote in message news:66f59a450506160623305c8b2d@mail.gmail.com... I have a custom stream that I am adaptiing to, so I build oarchive and iarchive classes derived from boost::archive::detail::common_xarchive according to the documentation. I have a function that looks like the following to handle the specifics of loading and saving. template<class T> void load(T & t) { // load data... } This seems to work for everything except std::string's. I noticed it when writing out a std::map<std::string, std::string>. The map is handled properly by the boost/serialization/map.hpp routines, but the strings are sent to my load function instead of being handled by boost/serialization/string.hpp. Any insight in to what I could possibly be doing wrong would be greatly appreciated. -doug ------------------------------------------------------------------------------ _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Doug Henry
-
Robert Ramey