views:

54

answers:

1

Dear StackOverFlowers,

I've got a variable with a declaration that looks like

boost::unordered_map< std::string, boost::unordered_map <long,int>, hashe::fnv_1a> _pl;

I need to serialise this to a file and and deserialise later. Should I just do a nested loop or can i do something ultracool with boost::serialisation? Any help pointing me towards nested declarations would be greatly appreciated.

Thanks in advance!

A: 

You have to define template function of serialization of each type. Boost serialization can be easily implemented for vectors and maps. Simply define serialize function for each type.

template<class Archive> void serialize(Archive& ar,unsigned int version)

For more help see some examples: Boost Serialization Example

Vivek