mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
std::shared_ptr works with pointer tracking
This commit is contained in:
@@ -6,20 +6,42 @@
|
||||
|
||||
namespace cereal
|
||||
{
|
||||
//! Serialization for std::array types to binary
|
||||
//! Saving for std::array primitive types to binary
|
||||
template <class T, size_t N>
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
||||
void save( BinaryOutputArchive & ar, std::array<T, N> const & array )
|
||||
{
|
||||
std::cout << "Saving array" << std::endl;
|
||||
std::cout << "Saving array (arith)" << std::endl;
|
||||
ar.save_binary( array.data(), N * sizeof(T) );
|
||||
}
|
||||
|
||||
//! Serialization for std::array to binary
|
||||
//! Loading for std::array primitive types to binary
|
||||
template <class T, size_t N>
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
||||
void load( BinaryInputArchive & ar, std::array<T, N> & array )
|
||||
{
|
||||
std::cout << "Loading array (arith)" << std::endl;
|
||||
ar.load_binary( array.data(), N * sizeof(T) );
|
||||
}
|
||||
|
||||
//! Saving for std::array all other types to binary
|
||||
template <class T, size_t N>
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
||||
void save( BinaryOutputArchive & ar, std::array<T, N> const & array )
|
||||
{
|
||||
std::cout << "Saving array" << std::endl;
|
||||
for( const auto & i : array )
|
||||
ar & i;
|
||||
}
|
||||
|
||||
//! Loading for std::array all other types to binary
|
||||
template <class T, size_t N>
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
||||
void load( BinaryInputArchive & ar, std::array<T, N> & array )
|
||||
{
|
||||
std::cout << "Loading array" << std::endl;
|
||||
ar.load_binary( array.data(), N * sizeof(T) );
|
||||
for( auto & i : array )
|
||||
ar & i;
|
||||
}
|
||||
} // namespace cereal
|
||||
|
||||
|
||||
Reference in New Issue
Block a user