const_cast for save(), seeking for binary_oarchive

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
This commit is contained in:
Shane Grant
2013-06-14 12:17:21 -07:00
parent 6821955323
commit e9d277025f
10 changed files with 114 additions and 37 deletions

View File

@@ -43,16 +43,6 @@ namespace cereal
ar & (*it);
}
//! Serialization for non-arithmetic (and bool) vector types to binary (non-const version)
template <class T, class A>
typename std::enable_if<!std::is_arithmetic<T>::value || std::is_same<T, bool>::value, void>::type
save( BinaryOutputArchive & ar, std::vector<T, A> & vector )
{
ar & vector.size(); // number of elements
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar & (*it);
}
//! Serialization for non-arithmetic (and bool) vector types from binary
template <class T, class A>
typename std::enable_if<!std::is_arithmetic<T>::value || std::is_same<T, bool>::value, void>::type