diff --git a/binary_archive/array.hpp b/binary_archive/array.hpp index 60f4a5c6..55defd6d 100644 --- a/binary_archive/array.hpp +++ b/binary_archive/array.hpp @@ -9,7 +9,7 @@ namespace cereal //! Saving for std::array primitive types to binary template typename std::enable_if::value, void>::type - void save( BinaryOutputArchive & ar, std::array const & array ) + save( BinaryOutputArchive & ar, std::array const & array ) { std::cout << "Saving array (arith)" << std::endl; ar.save_binary( array.data(), N * sizeof(T) ); @@ -18,7 +18,7 @@ namespace cereal //! Loading for std::array primitive types to binary template typename std::enable_if::value, void>::type - void load( BinaryInputArchive & ar, std::array & array ) + load( BinaryInputArchive & ar, std::array & array ) { std::cout << "Loading array (arith)" << std::endl; ar.load_binary( array.data(), N * sizeof(T) ); @@ -26,8 +26,8 @@ namespace cereal //! Saving for std::array all other types to binary template - typename std::enable_if::value, void>::type - void save( BinaryOutputArchive & ar, std::array const & array ) + typename std::enable_if::value, void>::type + save( BinaryOutputArchive & ar, std::array const & array ) { std::cout << "Saving array" << std::endl; for( const auto & i : array ) @@ -36,8 +36,8 @@ namespace cereal //! Loading for std::array all other types to binary template - typename std::enable_if::value, void>::type - void load( BinaryInputArchive & ar, std::array & array ) + typename std::enable_if::value, void>::type + load( BinaryInputArchive & ar, std::array & array ) { std::cout << "Loading array" << std::endl; for( auto & i : array ) diff --git a/binary_archive/dequeue.hpp b/binary_archive/dequeue.hpp new file mode 100644 index 00000000..f8315609 --- /dev/null +++ b/binary_archive/dequeue.hpp @@ -0,0 +1,33 @@ +#ifndef CEREAL_BINARY_ARCHIVE_DEQUE_HPP_ +#define CEREAL_BINARY_ARCHIVE_DEQUE_HPP_ + +#include +#include + +namespace cereal +{ + //! Saving for std::deque all other types to binary + template + void save( BinaryOutputArchive & ar, std::deque const & deque ) + { + ar & deque.size(); + + for( const auto & i : deque ) + ar & i; + } + + //! Loading for std::deque all other types to binary + template + void load( BinaryInputArchive & ar, std::deque & deque ) + { + size_t size; + ar & size; + + deque.resize( size ); + + for( auto & i : deque ) + ar & i; + } +} // namespace cereal + +#endif // CEREAL_BINARY_ARCHIVE_DEQUE_HPP_ diff --git a/binary_archive/forward_list.hpp b/binary_archive/forward_list.hpp new file mode 100644 index 00000000..15483168 --- /dev/null +++ b/binary_archive/forward_list.hpp @@ -0,0 +1,33 @@ +#ifndef CEREAL_BINARY_ARCHIVE_FORWARD_LIST_HPP_ +#define CEREAL_BINARY_ARCHIVE_FORWARD_LIST_HPP_ + +#include +#include + +namespace cereal +{ + //! Saving for std::forward_list all other types to binary + template + void save( BinaryOutputArchive & ar, std::forward_list const & forward_list ) + { + ar & forward_list.size(); + + for( const auto & i : forward_list ) + ar & i; + } + + //! Loading for std::forward_list all other types to binary + template + void load( BinaryInputArchive & ar, std::forward_list & forward_list ) + { + size_t size; + ar & size; + + forward_list.resize( size ); + + for( auto & i : forward_list ) + ar & i; + } +} // namespace cereal + +#endif // CEREAL_BINARY_ARCHIVE_FORWARD_LIST_HPP_ diff --git a/binary_archive/list.hpp b/binary_archive/list.hpp new file mode 100644 index 00000000..5ccfdb7e --- /dev/null +++ b/binary_archive/list.hpp @@ -0,0 +1,33 @@ +#ifndef CEREAL_BINARY_ARCHIVE_LIST_HPP_ +#define CEREAL_BINARY_ARCHIVE_LIST_HPP_ + +#include +#include + +namespace cereal +{ + //! Saving for std::list all other types to binary + template + void save( BinaryOutputArchive & ar, std::list const & list ) + { + ar & list.size(); + + for( const auto & i : list ) + ar & i; + } + + //! Loading for std::list all other types to binary + template + void load( BinaryInputArchive & ar, std::list & list ) + { + size_t size; + ar & size; + + list.resize( size ); + + for( auto & i : list ) + ar & i; + } +} // namespace cereal + +#endif // CEREAL_BINARY_ARCHIVE_LIST_HPP_