]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/include/boost/serialization/archive_input_unordered_map.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / serialization / include / boost / serialization / archive_input_unordered_map.hpp
1 #ifndef BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
2 #define BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_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 // serialization/unordered_map.hpp:
11 // serialization for stl unordered_map templates
12
13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
14 // (C) Copyright 2014 Jim Bell
15 // Use, modification and distribution is subject to the Boost Software
16 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18
19 // See http://www.boost.org for updates, documentation, and revision history.
20
21 #include <boost/config.hpp>
22
23 #include <boost/serialization/utility.hpp>
24
25 namespace boost {
26 namespace serialization {
27 namespace stl {
28
29 // map input
30 template<class Archive, class Container>
31 struct archive_input_unordered_map
32 {
33 inline void operator()(
34 Archive &ar,
35 Container &s,
36 const unsigned int v
37 ){
38 typedef typename Container::value_type type;
39 detail::stack_construct<Archive, type> t(ar, v);
40 ar >> boost::serialization::make_nvp("item", t.reference());
41 std::pair<typename Container::const_iterator, bool> result =
42 #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
43 s.insert(t.reference());
44 #else
45 s.emplace(t.reference());
46 #endif
47 // note: the following presumes that the map::value_type was NOT tracked
48 // in the archive. This is the usual case, but here there is no way
49 // to determine that.
50 if(result.second){
51 ar.reset_object_address(
52 & (result.first->second),
53 & t.reference().second
54 );
55 }
56 }
57 };
58
59 // multimap input
60 template<class Archive, class Container>
61 struct archive_input_unordered_multimap
62 {
63 inline void operator()(
64 Archive &ar,
65 Container &s,
66 const unsigned int v
67 ){
68 typedef typename Container::value_type type;
69 detail::stack_construct<Archive, type> t(ar, v);
70 ar >> boost::serialization::make_nvp("item", t.reference());
71 typename Container::const_iterator result =
72 #ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
73 s.insert(t.reference());
74 #else
75 s.emplace(t.reference());
76 #endif
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
79 // to determine that.
80 ar.reset_object_address(
81 & result->second,
82 & t.reference()
83 );
84 }
85 };
86
87 } // stl
88 } // namespace serialization
89 } // namespace boost
90
91 #endif // BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP