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