Hello,
I am trying to serialize std containers via boost::serialization, but
I am unable to get even simple code samples to compile. I used the
serialization test_map.cpp as a guide to arrive at the very simple
code that follows:
--- snip ---
#include
#include
#include
#include
#include <iostream>
#include <string>
#include <map>
int
main()
{
std::map data;
data.insert(std::make_pair("a", "b"));
data.insert(std::make_pair("b", "c"));
data.insert(std::make_pair("c", "d"));
boost::archive::xml_oarchive oa(std::cout);
oa << boost::serialization::make_nvp("data", data);
return 0;
}
--- snip ---
Can anyone spot misuse above, or give me some clue as to why this won't compile?
I am using boost 1.33.1, with GCC 4.1.1. If I change 'data' to be a
simple string, serialization works, but if I use any std::container
type (I've tried vector<string>, list<string>, and map
so far), I get an error of the following form:
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:131:
error: invalid use of undefined type 'T3', where
T1 = string
T2 = list<T1>
T3 = struct boost::serialization::extended_type_info_null<T2>
/usr/include/boost-1_33_1/boost/serialization/type_info_implementation.hpp:26:
error: declaration of 'T3', where
T1 = string
T2 = list<T1>
T3 = struct boost::serialization::extended_type_info_null<T2>
/usr/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:132:
error: invalid use of undefined type 'T3', where
T1 = string
T2 = list<T1>
T3 = struct boost::serialization::extended_type_info_null<T2>
/usr/include/boost-1_33_1/boost/serialization/type_info_implementation.hpp:26:
error: declaration of 'T3', where
T1 = string
T2 = list<T1>
T3 = struct boost::serialization::extended_type_info_null<T2>
Any assistance would be greatly appreciated.
- C.