Files
cereal/binary_archive
Randolph Voorhies d1abb9effa Fixing error when serializing arrays with internal
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.
2013-06-13 17:39:27 -07:00
..
2013-06-13 16:44:19 -07:00
2013-06-13 17:04:02 -07:00
2013-06-13 17:04:02 -07:00
2013-06-13 17:04:02 -07:00
2013-06-13 17:04:02 -07:00
2013-06-13 17:02:46 -07:00