Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/serialization/unordered_set.hpp @ 102:f46d142149f5
Whoops, finish that update
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:13:41 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
101:c530137014c0 | 102:f46d142149f5 |
---|---|
1 #ifndef BOOST_SERIALIZATION_UNORDERED_SET_HPP | |
2 #define BOOST_SERIALIZATION_UNORDERED_SET_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 // unordered_set.hpp: serialization for stl unordered_set templates | |
11 | |
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
13 // (C) Copyright 2014 Jim Bell | |
14 // Use, modification and distribution is subject to the Boost Software | |
15 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
16 // http://www.boost.org/LICENSE_1_0.txt) | |
17 | |
18 // See http://www.boost.org for updates, documentation, and revision history. | |
19 | |
20 #include <boost/config.hpp> | |
21 | |
22 #include <unordered_set> | |
23 | |
24 #include <boost/serialization/unordered_collections_save_imp.hpp> | |
25 #include <boost/serialization/unordered_collections_load_imp.hpp> | |
26 #include <boost/serialization/split_free.hpp> | |
27 | |
28 namespace boost { | |
29 namespace serialization { | |
30 | |
31 namespace stl { | |
32 | |
33 // unordered_set input | |
34 template<class Archive, class Container> | |
35 struct archive_input_unordered_set | |
36 { | |
37 inline void operator()( | |
38 Archive &ar, | |
39 Container &s, | |
40 const unsigned int v | |
41 ){ | |
42 typedef typename Container::value_type type; | |
43 detail::stack_construct<Archive, type> t(ar, v); | |
44 // borland fails silently w/o full namespace | |
45 ar >> boost::serialization::make_nvp("item", t.reference()); | |
46 std::pair<typename Container::const_iterator, bool> result = | |
47 s.insert(t.reference()); | |
48 if(result.second) | |
49 ar.reset_object_address(& (* result.first), & t.reference()); | |
50 } | |
51 }; | |
52 | |
53 // unordered_multiset input | |
54 template<class Archive, class Container> | |
55 struct archive_input_unordered_multiset | |
56 { | |
57 inline void operator()( | |
58 Archive &ar, | |
59 Container &s, | |
60 const unsigned int v | |
61 ){ | |
62 typedef typename Container::value_type type; | |
63 detail::stack_construct<Archive, type> t(ar, v); | |
64 // borland fails silently w/o full namespace | |
65 ar >> boost::serialization::make_nvp("item", t.reference()); | |
66 typename Container::const_iterator result | |
67 = s.insert(t.reference()); | |
68 ar.reset_object_address(& (* result), & t.reference()); | |
69 } | |
70 }; | |
71 | |
72 } // stl | |
73 | |
74 template< | |
75 class Archive, | |
76 class Key, | |
77 class HashFcn, | |
78 class EqualKey, | |
79 class Allocator | |
80 > | |
81 inline void save( | |
82 Archive & ar, | |
83 const std::unordered_set< | |
84 Key, HashFcn, EqualKey, Allocator | |
85 > &t, | |
86 const unsigned int /*file_version*/ | |
87 ){ | |
88 boost::serialization::stl::save_unordered_collection< | |
89 Archive, | |
90 std::unordered_set< | |
91 Key, HashFcn, EqualKey, Allocator | |
92 > | |
93 >(ar, t); | |
94 } | |
95 | |
96 template< | |
97 class Archive, | |
98 class Key, | |
99 class HashFcn, | |
100 class EqualKey, | |
101 class Allocator | |
102 > | |
103 inline void load( | |
104 Archive & ar, | |
105 std::unordered_set< | |
106 Key, HashFcn, EqualKey, Allocator | |
107 > &t, | |
108 const unsigned int /*file_version*/ | |
109 ){ | |
110 boost::serialization::stl::load_unordered_collection< | |
111 Archive, | |
112 std::unordered_set< | |
113 Key, HashFcn, EqualKey, Allocator | |
114 >, | |
115 boost::serialization::stl::archive_input_unordered_set< | |
116 Archive, | |
117 std::unordered_set< | |
118 Key, HashFcn, EqualKey, Allocator | |
119 > | |
120 > | |
121 >(ar, t); | |
122 } | |
123 | |
124 // split non-intrusive serialization function member into separate | |
125 // non intrusive save/load member functions | |
126 template< | |
127 class Archive, | |
128 class Key, | |
129 class HashFcn, | |
130 class EqualKey, | |
131 class Allocator | |
132 > | |
133 inline void serialize( | |
134 Archive & ar, | |
135 std::unordered_set< | |
136 Key, HashFcn, EqualKey, Allocator | |
137 > &t, | |
138 const unsigned int file_version | |
139 ){ | |
140 boost::serialization::split_free(ar, t, file_version); | |
141 } | |
142 | |
143 // unordered_multiset | |
144 template< | |
145 class Archive, | |
146 class Key, | |
147 class HashFcn, | |
148 class EqualKey, | |
149 class Allocator | |
150 > | |
151 inline void save( | |
152 Archive & ar, | |
153 const std::unordered_multiset< | |
154 Key, HashFcn, EqualKey, Allocator | |
155 > &t, | |
156 const unsigned int /*file_version*/ | |
157 ){ | |
158 boost::serialization::stl::save_unordered_collection< | |
159 Archive, | |
160 std::unordered_multiset< | |
161 Key, HashFcn, EqualKey, Allocator | |
162 > | |
163 >(ar, t); | |
164 } | |
165 | |
166 template< | |
167 class Archive, | |
168 class Key, | |
169 class HashFcn, | |
170 class EqualKey, | |
171 class Allocator | |
172 > | |
173 inline void load( | |
174 Archive & ar, | |
175 std::unordered_multiset< | |
176 Key, HashFcn, EqualKey, Allocator | |
177 > &t, | |
178 const unsigned int /*file_version*/ | |
179 ){ | |
180 boost::serialization::stl::load_unordered_collection< | |
181 Archive, | |
182 std::unordered_multiset< | |
183 Key, HashFcn, EqualKey, Allocator | |
184 >, | |
185 boost::serialization::stl::archive_input_unordered_multiset< | |
186 Archive, | |
187 std::unordered_multiset< | |
188 Key, HashFcn, EqualKey, Allocator | |
189 > | |
190 > | |
191 >(ar, t); | |
192 } | |
193 | |
194 // split non-intrusive serialization function member into separate | |
195 // non intrusive save/load member functions | |
196 template< | |
197 class Archive, | |
198 class Key, | |
199 class HashFcn, | |
200 class EqualKey, | |
201 class Allocator | |
202 > | |
203 inline void serialize( | |
204 Archive & ar, | |
205 std::unordered_multiset< | |
206 Key, HashFcn, EqualKey, Allocator | |
207 > &t, | |
208 const unsigned int file_version | |
209 ){ | |
210 boost::serialization::split_free(ar, t, file_version); | |
211 } | |
212 | |
213 } // namespace serialization | |
214 } // namespace boost | |
215 | |
216 #endif // BOOST_SERIALIZATION_UNORDERED_SET_HPP |