1 #ifndef BOOST_SERIALIZATION_UNORDERED_MAP_HPP
2 #define BOOST_SERIALIZATION_UNORDERED_MAP_HPP
3
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
8
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // serialization/unordered_map.hpp:
11 // serialization for stl unordered_map templates
12
13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
14 // (C) Copyright 2014 Jim Bell
15 // Use, modification and distribution is subject to the Boost Software
16 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18
19 // See http://www.boost.org for updates, documentation, and revision history.
20
21 #include <boost/config.hpp>
22
23 #include <unordered_map>
24
25 #include <boost/serialization/utility.hpp>
26 #include <boost/serialization/unordered_collections_save_imp.hpp>
27 #include <boost/serialization/unordered_collections_load_imp.hpp>
28 #include <boost/serialization/archive_input_unordered_map.hpp>
29 #include <boost/serialization/split_free.hpp>
30
31 namespace boost {
32 namespace serialization {
33
34 template<
35 class Archive,
36 class Key,
37 class T,
38 class HashFcn,
39 class EqualKey,
40 class Allocator
41 >
save(Archive & ar,const std::unordered_map<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)42 inline void save(
43 Archive & ar,
44 const std::unordered_map<Key, T, HashFcn, EqualKey, Allocator> &t,
45 const unsigned int /*file_version*/
46 ){
47 boost::serialization::stl::save_unordered_collection<
48 Archive,
49 std::unordered_map<Key, T, HashFcn, EqualKey, Allocator>
50 >(ar, t);
51 }
52
53 template<
54 class Archive,
55 class Key,
56 class T,
57 class HashFcn,
58 class EqualKey,
59 class Allocator
60 >
load(Archive & ar,std::unordered_map<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)61 inline void load(
62 Archive & ar,
63 std::unordered_map<Key, T, HashFcn, EqualKey, Allocator> &t,
64 const unsigned int /*file_version*/
65 ){
66 boost::serialization::stl::load_unordered_collection<
67 Archive,
68 std::unordered_map<Key, T, HashFcn, EqualKey, Allocator>,
69 boost::serialization::stl::archive_input_unordered_map<
70 Archive,
71 std::unordered_map<Key, T, HashFcn, EqualKey, Allocator>
72 >
73 >(ar, t);
74 }
75
76 // split non-intrusive serialization function member into separate
77 // non intrusive save/load member functions
78 template<
79 class Archive,
80 class Key,
81 class T,
82 class HashFcn,
83 class EqualKey,
84 class Allocator
85 >
serialize(Archive & ar,std::unordered_map<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int file_version)86 inline void serialize(
87 Archive & ar,
88 std::unordered_map<Key, T, HashFcn, EqualKey, Allocator> &t,
89 const unsigned int file_version
90 ){
91 boost::serialization::split_free(ar, t, file_version);
92 }
93
94 // unordered_multimap
95 template<
96 class Archive,
97 class Key,
98 class T,
99 class HashFcn,
100 class EqualKey,
101 class Allocator
102 >
save(Archive & ar,const std::unordered_multimap<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)103 inline void save(
104 Archive & ar,
105 const std::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator> &t,
106 const unsigned int /*file_version*/
107 ){
108 boost::serialization::stl::save_unordered_collection<
109 Archive,
110 std::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator>
111 >(ar, t);
112 }
113
114 template<
115 class Archive,
116 class Key,
117 class T,
118 class HashFcn,
119 class EqualKey,
120 class Allocator
121 >
load(Archive & ar,std::unordered_multimap<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)122 inline void load(
123 Archive & ar,
124 std::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator> &t,
125 const unsigned int /*file_version*/
126 ){
127 boost::serialization::stl::load_unordered_collection<
128 Archive,
129 std::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator>,
130 boost::serialization::stl::archive_input_unordered_multimap<
131 Archive,
132 std::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator>
133 >
134 >(ar, t);
135 }
136
137 // split non-intrusive serialization function member into separate
138 // non intrusive save/load member functions
139 template<
140 class Archive,
141 class Key,
142 class T,
143 class HashFcn,
144 class EqualKey,
145 class Allocator
146 >
serialize(Archive & ar,std::unordered_multimap<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int file_version)147 inline void serialize(
148 Archive & ar,
149 std::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator> &t,
150 const unsigned int file_version
151 ){
152 boost::serialization::split_free(ar, t, file_version);
153 }
154
155 } // namespace serialization
156 } // namespace boost
157
158 #endif // BOOST_SERIALIZATION_UNORDERED_MAP_HPP
159