Hi,
i just recently startet to dip into boost::serialization. In the examples
directory, there is demo.cpp, in which text_archive is used.
From my understanding of the tutorial ("In addition to text archives, the
library includes archive class for native binary data and xml formatted data
Interfaces to all archive classes are all identical.") it should be possible
to switch from text_archive to xml_archive by just replacing text_[io]archive
by xml_[io]archive and include the required header files.
However, when I do this, I'm getting lots of compiler error messages like
(Linux, gcc-4.1.2, boost-1.35.0)
/usr/include/boost-1_35/boost/archive/basic_xml_oarchive.hpp: In member function 'void boost::archive::basic_xml_oarchive<Archive>::save_override(T&, int) [with T = const bus_schedule, Archive = boost::archive::xml_oarchive]':
/usr/include/boost-1_35/boost/archive/detail/interface_oarchive.hpp:64: instantiated from 'Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = const bus_schedule, Archive = boost::archive::xml_oarchive]'
demo-using-xml.cpp:286: instantiated from here
/usr/include/boost-1_35/boost/archive/basic_xml_oarchive.hpp:88: error: no matching function for call to 'assertion_failed(mpl_::failed************ boost::serialization::is_wrapper<const bus_schedule>::************)'
/usr/include/boost-1_35/boost/archive/basic_xml_iarchive.hpp: In member function 'void boost::archive::basic_xml_iarchive<Archive>::load_override(T&, int) [with T = bus_schedule, Archive = boost::archive::xml_iarchive]':
/usr/include/boost-1_35/boost/archive/xml_iarchive.hpp:74: instantiated from 'void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = bus_schedule, Archive = boost::archive::xml_iarchive]'
/usr/include/boost-1_35/boost/archive/detail/interface_iarchive.hpp:63: instantiated from 'Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = bus_schedule, Archive = boost::archive::xml_iarchive]'
demo-using-xml.cpp:297: instantiated from here
The original demo.cpp however compiles fine.
The difference to the version using xml_archive is just:
--- demo.cpp 2008-08-11 18:06:45.394403000 +0200
+++ demo-using-xml.cpp 2008-08-12 07:33:33.147259000 +0200
@@ -14,8 +14,8 @@
#include
using xml requires a little extra sauce to associate that "name" with the data item. Look deeper into the manual and check out other examples like demo_xml. Robert Ramey Markus Schwarzenberg wrote:
Hi,
i just recently startet to dip into boost::serialization. In the examples directory, there is demo.cpp, in which text_archive is used.
From my understanding of the tutorial ("In addition to text archives, the library includes archive class for native binary data and xml formatted data Interfaces to all archive classes are all identical.") it should be possible to switch from text_archive to xml_archive by just replacing text_[io]archive by xml_[io]archive and include the required header files.
participants (2)
-
Markus Schwarzenberg
-
Robert Ramey