1 #ifndef BOOST_SERIALIZATION_HASH_MAP_HPP
2 #define BOOST_SERIALIZATION_HASH_MAP_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // serialization/hash_map.hpp:
11 // serialization for stl hash_map templates
13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
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)
18 // See http://www.boost.org for updates, documentation, and revision history.
20 #include <boost/config.hpp>
22 #include BOOST_HASH_MAP_HEADER
24 #include <boost/serialization/utility.hpp>
25 #include <boost/serialization/hash_collections_save_imp.hpp>
26 #include <boost/serialization/hash_collections_load_imp.hpp>
27 #include <boost/serialization/split_free.hpp>
28 #include <boost/move/utility_core.hpp>
31 namespace serialization {
36 template<class Archive, class Container>
37 struct archive_input_hash_map
39 inline void operator()(
44 typedef typename Container::value_type type;
45 detail::stack_construct<Archive, type> t(ar, v);
46 // borland fails silently w/o full namespace
47 ar >> boost::serialization::make_nvp("item", t.reference());
48 std::pair<typename Container::const_iterator, bool> result =
49 s.insert(boost::move(t.reference()));
50 // note: the following presumes that the map::value_type was NOT tracked
51 // in the archive. This is the usual case, but here there is no way
54 ar.reset_object_address(
55 & (result.first->second),
56 & t.reference().second
63 template<class Archive, class Container>
64 struct archive_input_hash_multimap
66 inline void operator()(
71 typedef typename Container::value_type type;
72 detail::stack_construct<Archive, type> t(ar, v);
73 // borland fails silently w/o full namespace
74 ar >> boost::serialization::make_nvp("item", t.reference());
75 typename Container::const_iterator result
76 = s.insert(boost::move(t.reference()));
77 // note: the following presumes that the map::value_type was NOT tracked
78 // in the archive. This is the usual case, but here there is no way
80 ar.reset_object_address(
98 const BOOST_STD_EXTENSION_NAMESPACE::hash_map<
99 Key, HashFcn, EqualKey, Allocator
101 const unsigned int file_version
103 boost::serialization::stl::save_hash_collection<
105 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
106 Key, HashFcn, EqualKey, Allocator
120 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
121 Key, HashFcn, EqualKey, Allocator
123 const unsigned int file_version
125 boost::serialization::stl::load_hash_collection<
127 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
128 Key, HashFcn, EqualKey, Allocator
130 boost::serialization::stl::archive_input_hash_map<
132 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
133 Key, HashFcn, EqualKey, Allocator
139 // split non-intrusive serialization function member into separate
140 // non intrusive save/load member functions
148 inline void serialize(
150 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
151 Key, HashFcn, EqualKey, Allocator
153 const unsigned int file_version
155 boost::serialization::split_free(ar, t, file_version);
168 const BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
169 Key, HashFcn, EqualKey, Allocator
171 const unsigned int file_version
173 boost::serialization::stl::save_hash_collection<
175 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
176 Key, HashFcn, EqualKey, Allocator
190 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
191 Key, HashFcn, EqualKey, Allocator
193 const unsigned int file_version
195 boost::serialization::stl::load_hash_collection<
197 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
198 Key, HashFcn, EqualKey, Allocator
200 boost::serialization::stl::archive_input_hash_multimap<
202 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
203 Key, HashFcn, EqualKey, Allocator
209 // split non-intrusive serialization function member into separate
210 // non intrusive save/load member functions
218 inline void serialize(
220 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
221 Key, HashFcn, EqualKey, Allocator
223 const unsigned int file_version
225 boost::serialization::split_free(ar, t, file_version);
228 } // namespace serialization
231 #endif // BOOST_HAS_HASH
232 #endif // BOOST_SERIALIZATION_HASH_MAP_HPP