Using const cast to get rid of having two versions of save (changed vector and array so far)
Initial implementation of seeking to allow saving and restoring position within a binary archive
Also, forward_list has no .size() method. For now, we're using a linear
traversal of the container with std::distance. We may want to do
something more efficient later?
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.