1 #ifndef BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
2 #define BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // serialization/unordered_map.hpp:
11 // serialization for stl unordered_map templates
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)
19 // See http://www.boost.org for updates, documentation, and revision history.
21 #include <boost/config.hpp>
23 #include <boost/serialization/utility.hpp>
26 namespace serialization {
30 template<class Archive, class Container>
31 struct archive_input_unordered_map
33 inline void operator()(
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());
45 s.emplace(t.reference());
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
51 ar.reset_object_address(
52 & (result.first->second),
53 & t.reference().second
60 template<class Archive, class Container>
61 struct archive_input_unordered_multimap
63 inline void operator()(
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());
75 s.emplace(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(
88 } // namespace serialization
91 #endif // BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP