|
Boost Users : |
From: Michael Sperber (sperber_at_[hidden])
Date: 2006-02-22 06:01:58
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.
-- Cheers =8-} Mike Friede, Völkerverständigung und überhaupt blabla --=-=-= g++ -g -Wall -I /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1 -c -o mtime.o mtime.cpp /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/iserializer.hpp: In constructor `boost::archive::detail::iserializer<Archive, T>::iserializer() [with Archive = boost::archive::polymorphic_iarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]': /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/iserializer.hpp:146: instantiated from `static boost::archive::detail::iserializer<Archive, T>& boost::archive::detail::iserializer<Archive, T>::instantiate() [with Archive = boost::archive::polymorphic_iarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/iserializer.hpp:375: instantiated from `static void boost::archive::detail::load_non_pointer_type<Archive, T>::load_standard::invoke(Archive&, T&) [with Archive = boost::archive::polymorphic_iarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/iserializer.hpp:425: instantiated from `static void boost::archive::detail::load_non_pointer_type<Archive, T>::invoke(Archive&, T&) [with Archive = boost::archive::polymorphic_iarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/iserializer.hpp:572: instantiated from `void boost::archive::load(Archive&, T&) [with Archive = boost::archive::polymorphic_iarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/polymorphic_iarchive.hpp:127: instantiated from `void boost::archive::polymorphic_iarchive::load_override(const boost::serialization::nvp<T>&, int) [with T = std::string]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/interface_iarchive.hpp:76: instantiated from `Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = const boost::serialization::nvp<std::string>, Archive = boost::archive::polymorphic_iarchive]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/interface_iarchive.hpp:83: instantiated from `Archive& boost::archive::detail::interface_iarchive<Archive>::operator&(T&) [with T = const boost::serialization::nvp<std::string>, Archive = boost::archive::polymorphic_iarchive]' mtime.cpp:36: instantiated from here /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/iserializer.hpp:115: error: incomplete type `boost::serialization::extended_type_info_null<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >' used in nested name specifier /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp: In constructor `boost::archive::detail::oserializer<Archive, T>::oserializer() [with Archive = boost::archive::polymorphic_oarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]': /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:135: instantiated from `static boost::archive::detail::oserializer<Archive, T>& boost::archive::detail::oserializer<Archive, T>::instantiate() [with Archive = boost::archive::polymorphic_oarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:264: instantiated from `static void boost::archive::detail::save_non_pointer_type<Archive, T>::save_standard::invoke(Archive&, const T&) [with Archive = boost::archive::polymorphic_oarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:322: instantiated from `static void boost::archive::detail::save_non_pointer_type<Archive, T>::invoke(Archive&, const T&) [with Archive = boost::archive::polymorphic_oarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:536: instantiated from `void boost::archive::save(Archive&, const T&) [with Archive = boost::archive::polymorphic_oarchive, T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/polymorphic_oarchive.hpp:128: instantiated from `void boost::archive::polymorphic_oarchive::save_override(const boost::serialization::nvp<T>&, int) [with T = std::string]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/interface_oarchive.hpp:78: instantiated from `Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = const boost::serialization::nvp<std::string>, Archive = boost::archive::polymorphic_oarchive]' /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/interface_oarchive.hpp:86: instantiated from `Archive& boost::archive::detail::interface_oarchive<Archive>::operator&(T&) [with T = const boost::serialization::nvp<std::string>, Archive = boost::archive::polymorphic_oarchive]' mtime.cpp:46: instantiated from here /afs/informatik.uni-tuebingen.de/i386_fbsd54/boost-1.33.1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:108: error: incomplete type `boost::serialization::extended_type_info_null<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >' used in nested name specifier make: *** [mtime.o] Error 1 Compilation exited abnormally with code 2 at Wed Feb 22 11:56:36 --=-=-=--
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net