We need to be careful about accepting values as const in our save and
load functions for containers. Consider the following example:
SomeStruct has an internal serialize method. We want to serialize an
array of these things, and so we write a function like:
void save(BinaryOutputArchive & ar, std::array<SomeStruct, N> const & arr)
{
for(SomeStruct const & s : arr) ar & s;
}
Now we're screwed, because SomeStruct's serialize function looks like
this:
struct SomeStruct
{
template<class Archive>
void serialize(Archive & ar) // notice there is no const qualifier here!
{ ... whatever ... }
};
So, the solution is to write a non-const and a const version of save for
containers of non-arithmetic types.