|
1 #ifndef BOOST_SERIALIZATION_SET_HPP |
|
2 #define BOOST_SERIALIZATION_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 // set.hpp: serialization for stl set templates |
|
11 |
|
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) |
|
16 |
|
17 // See http://www.boost.org for updates, documentation, and revision history. |
|
18 |
|
19 #include <set> |
|
20 |
|
21 #include <boost/config.hpp> |
|
22 |
|
23 #include <boost/serialization/collections_save_imp.hpp> |
|
24 #include <boost/serialization/collections_load_imp.hpp> |
|
25 #include <boost/serialization/split_free.hpp> |
|
26 |
|
27 namespace boost { |
|
28 namespace serialization { |
|
29 |
|
30 template<class Archive, class Key, class Compare, class Allocator > |
|
31 inline void save( |
|
32 Archive & ar, |
|
33 const std::set<Key, Compare, Allocator> &t, |
|
34 const unsigned int /* file_version */ |
|
35 ){ |
|
36 boost::serialization::stl::save_collection< |
|
37 Archive, std::set<Key, Compare, Allocator> |
|
38 >(ar, t); |
|
39 } |
|
40 |
|
41 template<class Archive, class Key, class Compare, class Allocator > |
|
42 inline void load( |
|
43 Archive & ar, |
|
44 std::set<Key, Compare, Allocator> &t, |
|
45 const unsigned int /* file_version */ |
|
46 ){ |
|
47 boost::serialization::stl::load_collection< |
|
48 Archive, |
|
49 std::set<Key, Compare, Allocator>, |
|
50 boost::serialization::stl::archive_input_unique< |
|
51 Archive, std::set<Key, Compare, Allocator> |
|
52 >, |
|
53 boost::serialization::stl::no_reserve_imp<std::set< |
|
54 Key, Compare, Allocator> |
|
55 > |
|
56 >(ar, t); |
|
57 } |
|
58 |
|
59 // split non-intrusive serialization function member into separate |
|
60 // non intrusive save/load member functions |
|
61 template<class Archive, class Key, class Compare, class Allocator > |
|
62 inline void serialize( |
|
63 Archive & ar, |
|
64 std::set<Key, Compare, Allocator> & t, |
|
65 const unsigned int file_version |
|
66 ){ |
|
67 boost::serialization::split_free(ar, t, file_version); |
|
68 } |
|
69 |
|
70 // multiset |
|
71 template<class Archive, class Key, class Compare, class Allocator > |
|
72 inline void save( |
|
73 Archive & ar, |
|
74 const std::multiset<Key, Compare, Allocator> &t, |
|
75 const unsigned int /* file_version */ |
|
76 ){ |
|
77 boost::serialization::stl::save_collection< |
|
78 Archive, |
|
79 std::multiset<Key, Compare, Allocator> |
|
80 >(ar, t); |
|
81 } |
|
82 |
|
83 template<class Archive, class Key, class Compare, class Allocator > |
|
84 inline void load( |
|
85 Archive & ar, |
|
86 std::multiset<Key, Compare, Allocator> &t, |
|
87 const unsigned int /* file_version */ |
|
88 ){ |
|
89 boost::serialization::stl::load_collection< |
|
90 Archive, |
|
91 std::multiset<Key, Compare, Allocator>, |
|
92 boost::serialization::stl::archive_input_multi< |
|
93 Archive, std::multiset<Key, Compare, Allocator> |
|
94 >, |
|
95 boost::serialization::stl::no_reserve_imp< |
|
96 std::multiset<Key, Compare, Allocator> |
|
97 > |
|
98 >(ar, t); |
|
99 } |
|
100 |
|
101 // split non-intrusive serialization function member into separate |
|
102 // non intrusive save/load member functions |
|
103 template<class Archive, class Key, class Compare, class Allocator > |
|
104 inline void serialize( |
|
105 Archive & ar, |
|
106 std::multiset<Key, Compare, Allocator> & t, |
|
107 const unsigned int file_version |
|
108 ){ |
|
109 boost::serialization::split_free(ar, t, file_version); |
|
110 } |
|
111 |
|
112 } // namespace serialization |
|
113 } // namespace boost |
|
114 |
|
115 #include <boost/serialization/collection_traits.hpp> |
|
116 |
|
117 BOOST_SERIALIZATION_COLLECTION_TRAITS(std::set) |
|
118 BOOST_SERIALIZATION_COLLECTION_TRAITS(std::multiset) |
|
119 |
|
120 #endif // BOOST_SERIALIZATION_SET_HPP |