Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:30:59

0001 #ifndef  BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
0002 #define BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // serialization/unordered_map.hpp:
0011 // serialization for stl unordered_map templates
0012 
0013 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0014 // (C) Copyright 2014 Jim Bell
0015 // Use, modification and distribution is subject to the Boost Software
0016 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0017 // http://www.boost.org/LICENSE_1_0.txt)
0018 
0019 //  See http://www.boost.org for updates, documentation, and revision history.
0020 
0021 #include <boost/config.hpp>
0022 #include <boost/serialization/nvp.hpp>
0023 #include <boost/serialization/detail/stack_constructor.hpp>
0024 #include <boost/serialization/utility.hpp>
0025 #include <boost/move/utility_core.hpp>
0026 
0027 namespace boost {
0028 namespace serialization {
0029 namespace stl {
0030 
0031 // map input
0032 template<class Archive, class Container>
0033 struct archive_input_unordered_map
0034 {
0035     inline void operator()(
0036         Archive &ar,
0037         Container &s,
0038         const unsigned int v
0039     ){
0040         typedef typename Container::value_type type;
0041         detail::stack_construct<Archive, type> t(ar, v);
0042         ar >> boost::serialization::make_nvp("item", t.reference());
0043         std::pair<typename Container::const_iterator, bool> result =
0044             s.insert(boost::move(t.reference()));
0045         // note: the following presumes that the map::value_type was NOT tracked
0046         // in the archive.  This is the usual case, but here there is no way
0047         // to determine that.
0048         if(result.second){
0049             ar.reset_object_address(
0050                 & (result.first->second),
0051                 & t.reference().second
0052             );
0053         }
0054     }
0055 };
0056 
0057 // multimap input
0058 template<class Archive, class Container>
0059 struct archive_input_unordered_multimap
0060 {
0061     inline void operator()(
0062         Archive &ar,
0063         Container &s,
0064         const unsigned int v
0065     ){
0066         typedef typename Container::value_type type;
0067         detail::stack_construct<Archive, type> t(ar, v);
0068         ar >> boost::serialization::make_nvp("item", t.reference());
0069         typename Container::const_iterator result =
0070             s.insert(t.reference());
0071         // note: the following presumes that the map::value_type was NOT tracked
0072         // in the archive.  This is the usual case, but here there is no way
0073         // to determine that.
0074         ar.reset_object_address(
0075             & result->second,
0076             & t.reference()
0077         );
0078     }
0079 };
0080 
0081 } // stl
0082 } // namespace serialization
0083 } // namespace boost
0084 
0085 #endif // BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP