I'm having a bit of trouble using boost.serialization with a std::map.
It seems like there is something simple I'm not doing correctly. I'm
hoping someone can point me in the right direction.
Thanks,
David K.
I'm using VS2005. Here is my test code:
#include <map>
#include <fstream>
#include "boost/serialization/map.hpp"
#include "boost/archive/xml_oarchive.hpp"
std::map map1;
int main(int argc, char**argv)
{
map1[1] = 100;
std::ofstream os("out.xml");
boost::archive::xml_oarchive oa(os);
oa << BOOST_SERIALIZATION_NVP(map1);
}
This is the error:
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(131)
: error C2027: use of undefined type
'boost::serialization::extended_type_info_null<T>'
with
[
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(128)
: while compiling class template member function 'bool
boost::archive::detail::oserializer::is_polymorphic(void)
const'
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(264)
: see reference to class template instantiation
'boost::archive::detail::oserializer' being compiled
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(263)
: while compiling class template member function 'void
boost::archive::detail::save_non_pointer_type::save_standard::invoke(Archive
&,const T &)'
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(322)
: see reference to class template instantiation
'boost::archive::detail::save_non_pointer_type::save_standard'
being compiled
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(310)
: while compiling class template member function 'void
boost::archive::detail::save_non_pointer_type::invoke(Archive
&,const T &)'
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\oserializer.hpp(536)
: see reference to class template instantiation
'boost::archive::detail::save_non_pointer_type' being
compiled
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\basic_xml_oarchive.hpp(99)
: see reference to function template instantiation 'void
boost::archive::save(Archive &,const T &)' being compiled
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]
...boost-win32-1_33_1\include\boost\archive\detail\interface_oarchive.hpp(78)
: see reference to function template instantiation 'void
boost::archive::basic_xml_oarchive<Archive>::save_override>(const
boost::serialization::nvp<T> &,int)' being compiled
with
[
Archive=boost::archive::xml_oarchive,
_Kty=int,
_Ty=int,
T=std::map
]
...\source1.cpp(14) : see reference to function template
instantiation 'Archive
&boost::archive::detail::interface_oarchive<Archive>::operator
<<(const
boost::serialization::nvp<T> &)' being compiled
with
[
Archive=boost::archive::xml_oarchive,
T=std::map
]