working on pointer support

This commit is contained in:
Shane Grant
2013-06-13 12:17:59 -07:00
parent 4d56ae215b
commit 97304f8272
8 changed files with 99 additions and 155 deletions

View File

@@ -20,10 +20,10 @@ namespace cereal
}
//! Serialization for std::vector to binary
template <class T>
template <class T, class A>
void load( BinaryInputArchive & ar, std::vector<T, A> & vector )
{
std::cout << "Loading array" << std::endl;
std::cout << "Loading vector" << std::endl;
size_t dataSize;
size_t vectorSize;
@@ -34,6 +34,29 @@ namespace cereal
ar.load_binary( vector.data(), dataSize );
}
//! Serialization for std::vector<bool, A> types to binary
template <class A>
void save( BinaryOutputArchive & ar, std::vector<bool, A> const & vector )
{
std::cout << "Saving vector of bool" << std::endl;
ar & vector.size(); // number of elements
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar & (*it);
}
//! Serialization for std::vector<bool, A> to binary
template <class A>
void load( BinaryInputArchive & ar, std::vector<bool, A> & vector )
{
size_t size;
ar & size;
vector.resize( size );
for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar & (*it);
}
} // namespace cereal
#endif // CEREAL_BINARY_ARCHIVE_VECTOR_HPP_