
I'm not sure what the problem is with having an std::list have its own NVP but you can easily handle tihs yourself without using the definition of std::list serialization included in the package. class my_class { std::list<int> my_list; // instead of the following template<class Archive> void serialize(Archive &ar, const unsigned int version){ ar & BOOST_SERIALZATION_NVP(my_list) } // do the fillowing template<class Archive> void save(Archive &ar, const unsigned int version){ ar << make_nvp("size", my_list::size()); std::list::const_iterator litr = my_list.begin(); for(unsigned i = my_list::size(); --i; i > 0){ ar << make_nvp("list_element", *litr++); } } ... load... }; Robert Ramey Devin Fallak wrote:
Hi all,
I'm working with the Serialization library and trying to output a list of objects into an XML file. The problem I'm having is that in serializing a std::list, the Serialization library requires that the list itself is given a NVP. The specification I'm working with requires a list of undefined length WITHOUT its own NVP.
Is there any way to serialize a std::list into/out of an xml_oarchive/xml_iarchive?
Any help would be much appreciated.
Thanks,
Devin Fallak