6 #ifndef TURI_SERIALIZE_UNORDERED_MAP_HPP 7 #define TURI_SERIALIZE_UNORDERED_MAP_HPP 9 #include <boost/unordered_map.hpp> 10 #include <core/storage/serialization/iarchive.hpp> 11 #include <core/storage/serialization/oarchive.hpp> 12 #include <core/storage/serialization/iterator.hpp> 16 namespace archive_detail {
18 template <
typename OutArcType,
typename T,
typename U>
19 struct serialize_impl<OutArcType,
boost::unordered_map<T,U>, false > {
20 static void exec(OutArcType& oarc,
21 const boost::unordered_map<T,U>& vec){
23 vec.begin(), vec.end(), vec.size());
29 template <
typename InArcType,
typename T,
typename U>
30 struct deserialize_impl<InArcType,
boost::unordered_map<T,U>, false > {
31 static void exec(InArcType& iarc, boost::unordered_map<T,U>& vec){
37 for (
size_t x = 0; x < length ; ++x){
40 vec[v.first] = v.second;
50 #if defined(__cplusplus) && __cplusplus >= 201103L 51 #include <unordered_map> 54 namespace archive_detail {
56 template <
typename OutArcType,
typename T,
typename U>
57 struct serialize_impl<OutArcType,
std::unordered_map<T,U>, false > {
58 static void exec(OutArcType& oarc,
59 const std::unordered_map<T,U>& vec){
61 vec.begin(), vec.end(), vec.size());
67 template <
typename InArcType,
typename T,
typename U>
68 struct deserialize_impl<InArcType,
std::unordered_map<T,U>, false > {
69 static void exec(InArcType& iarc, std::unordered_map<T,U>& vec){
75 for (
size_t x = 0; x < length ; ++x){
78 vec[v.first] = v.second;
void serialize_iterator(OutArcType &oarc, RandomAccessIterator begin, RandomAccessIterator end)
Serializes the contents between the iterators begin and end.