#ifndef CEREAL_BINARY_ARCHIVE_MAP_HPP_ #define CEREAL_BINARY_ARCHIVE_MAP_HPP_ #include #include namespace cereal { //! Saving for std::map all other types to binary template void save( BinaryOutputArchive & ar, std::map const & map ) { ar & map.size(); for( const auto & i : map ) { ar & i.first; ar & i.second; } } //! Loading for std::map all other types to binary template void load( BinaryInputArchive & ar, std::map & map ) { size_t size; ar & size; for( size_t i = 0; i < size; ++i ) { K key; T value; ar & key; ar & value; map.insert( {key, value} ); } } //! Saving for std::multimap all other types to binary template void save( BinaryOutputArchive & ar, std::multimap const & multimap ) { ar & multimap.size(); for( const auto & i : multimap ) { ar & i.first; ar & i.second; } } //! Loading for std::multimap all other types to binary template void load( BinaryInputArchive & ar, std::multimap & multimap ) { size_t size; ar & size; for( size_t i = 0; i < size; ++i ) { K key; T value; ar & key; ar & value; multimap.insert( {key, value} ); } } } // namespace cereal #endif // CEREAL_BINARY_ARCHIVE_MAP_HPP_