1 #ifndef BOOST_SERIALIZATION_HASH_SET_HPP
2 #define BOOST_SERIALIZATION_HASH_SET_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // hash_set.hpp: serialization for stl hash_set templates
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/config.hpp>
21 #include BOOST_HASH_SET_HEADER
23 #include <boost/serialization/hash_collections_save_imp.hpp>
24 #include <boost/serialization/hash_collections_load_imp.hpp>
25 #include <boost/serialization/split_free.hpp>
28 namespace serialization {
33 template<class Archive, class Container>
34 struct archive_input_hash_set
36 inline void operator()(
41 typedef typename Container::value_type type;
42 detail::stack_construct<Archive, type> t(ar, v);
43 // borland fails silently w/o full namespace
44 ar >> boost::serialization::make_nvp("item", t.reference());
45 std::pair<typename Container::const_iterator, bool> result =
46 s.insert(t.reference());
48 ar.reset_object_address(& (* result.first), & t.reference());
52 // hash_multiset input
53 template<class Archive, class Container>
54 struct archive_input_hash_multiset
56 inline void operator()(
61 typedef typename Container::value_type type;
62 detail::stack_construct<Archive, type> t(ar, v);
63 // borland fails silently w/o full namespace
64 ar >> boost::serialization::make_nvp("item", t.reference());
65 typename Container::const_iterator result
66 = s.insert(t.reference());
67 ar.reset_object_address(& (* result), & t.reference());
82 const BOOST_STD_EXTENSION_NAMESPACE::hash_set<
83 Key, HashFcn, EqualKey, Allocator
85 const unsigned int file_version
87 boost::serialization::stl::save_hash_collection<
89 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
90 Key, HashFcn, EqualKey, Allocator
104 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
105 Key, HashFcn, EqualKey, Allocator
107 const unsigned int file_version
109 boost::serialization::stl::load_hash_collection<
111 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
112 Key, HashFcn, EqualKey, Allocator
114 boost::serialization::stl::archive_input_hash_set<
116 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
117 Key, HashFcn, EqualKey, Allocator
123 // split non-intrusive serialization function member into separate
124 // non intrusive save/load member functions
132 inline void serialize(
134 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
135 Key, HashFcn, EqualKey, Allocator
137 const unsigned int file_version
139 boost::serialization::split_free(ar, t, file_version);
152 const BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
153 Key, HashFcn, EqualKey, Allocator
155 const unsigned int file_version
157 boost::serialization::stl::save_hash_collection<
159 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
160 Key, HashFcn, EqualKey, Allocator
174 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
175 Key, HashFcn, EqualKey, Allocator
177 const unsigned int file_version
179 boost::serialization::stl::load_hash_collection<
181 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
182 Key, HashFcn, EqualKey, Allocator
184 boost::serialization::stl::archive_input_hash_multiset<
186 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
187 Key, HashFcn, EqualKey, Allocator
193 // split non-intrusive serialization function member into separate
194 // non intrusive save/load member functions
202 inline void serialize(
204 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
205 Key, HashFcn, EqualKey, Allocator
207 const unsigned int file_version
209 boost::serialization::split_free(ar, t, file_version);
212 } // namespace serialization
215 #include <boost/serialization/collection_traits.hpp>
217 BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::hash_set)
218 BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::hash_multiset)
220 #endif // BOOST_HAS_HASH
221 #endif // BOOST_SERIALIZATION_HASH_SET_HPP