1 | #ifndef BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_SET_HPP |
2 | #define BOOST_SERIALIZATION_ARCHIVE_INPUT_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 | // archive_input_unordered_set.hpp |
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 | namespace boost { |
23 | namespace serialization { |
24 | |
25 | namespace stl { |
26 | |
27 | // unordered_set input |
28 | template<class Archive, class Container> |
29 | struct archive_input_unordered_set |
30 | { |
31 | inline void operator()( |
32 | Archive &ar, |
33 | Container &s, |
34 | const unsigned int v |
35 | ){ |
36 | typedef typename Container::value_type type; |
37 | detail::stack_construct<Archive, type> t(ar, v); |
38 | // borland fails silently w/o full namespace |
39 | ar >> boost::serialization::make_nvp("item" , t.reference()); |
40 | std::pair<typename Container::const_iterator, bool> result = |
41 | s.insert(t.reference()); |
42 | if(result.second) |
43 | ar.reset_object_address(& (* result.first), & t.reference()); |
44 | } |
45 | }; |
46 | |
47 | // unordered_multiset input |
48 | template<class Archive, class Container> |
49 | struct archive_input_unordered_multiset |
50 | { |
51 | inline void operator()( |
52 | Archive &ar, |
53 | Container &s, |
54 | const unsigned int v |
55 | ){ |
56 | typedef typename Container::value_type type; |
57 | detail::stack_construct<Archive, type> t(ar, v); |
58 | // borland fails silently w/o full namespace |
59 | ar >> boost::serialization::make_nvp("item" , t.reference()); |
60 | typename Container::const_iterator result |
61 | = s.insert(t.reference()); |
62 | ar.reset_object_address(& (* result), & t.reference()); |
63 | } |
64 | }; |
65 | |
66 | } // stl |
67 | } // serialization |
68 | } // boost |
69 | |
70 | #endif // BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_SET_HPP |
71 | |