Boost logo

Boost Users :

From: Cory Omand (coryomand_at_[hidden])
Date: 2007-09-12 19:07:59


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 <boost/serialization/map.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <iostream>
#include <string>
#include <map>

int
main()
{
    std::map<std::string, std::string> 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<string,string>
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.


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