Made a special case for arithmetic vectors

This commit is contained in:
Randolph Voorhies
2013-06-13 13:29:37 -07:00
parent 97304f8272
commit e11edef4c8

View File

@@ -6,9 +6,10 @@
namespace cereal namespace cereal
{ {
//! Serialization for std::vector types to binary //! Serialization for std::vectors of arithmetic types to binary
template <class T, class A> template <class T, class A>
void save( BinaryOutputArchive & ar, std::vector<T, A> const & vector ) typename std::enable_if<std::is_arithmetic<T>::value, void>::type
save( BinaryOutputArchive & ar, std::vector<T, A> const & vector )
{ {
std::cout << "Saving vector" << std::endl; std::cout << "Saving vector" << std::endl;
@@ -19,10 +20,11 @@ namespace cereal
ar.save_binary( array.data(), size ); // actual data ar.save_binary( array.data(), size ); // actual data
} }
//! Serialization for std::vector to binary //! Serialization for std::vectors of arithmetic types to binary
template <class T, class A> template <class T, class A>
void load( BinaryInputArchive & ar, std::vector<T, A> & vector ) typename std::enable_if<std::is_arithmetic<T>::value, void>::type
{ load( BinaryInputArchive & ar, std::vector<T, A> & vector )
{
std::cout << "Loading vector" << std::endl; std::cout << "Loading vector" << std::endl;
size_t dataSize; size_t dataSize;