Chris@102: #ifndef BOOST_SERIALIZATION_UNORDERED_COLLECTIONS_LOAD_IMP_HPP Chris@102: #define BOOST_SERIALIZATION_UNORDERED_COLLECTIONS_LOAD_IMP_HPP Chris@102: Chris@102: // MS compatible compilers support #pragma once Chris@102: #if defined(_MSC_VER) && (_MSC_VER >= 1020) Chris@102: # pragma once Chris@102: # pragma warning (disable : 4786) // too long name, harmless warning Chris@102: #endif Chris@102: Chris@102: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@102: // unordered_collections_load_imp.hpp: serialization for loading stl collections Chris@102: Chris@102: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Chris@102: // (C) Copyright 2014 Jim Bell Chris@102: // Use, modification and distribution is subject to the Boost Software Chris@102: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@102: // http://www.boost.org/LICENSE_1_0.txt) Chris@102: Chris@102: // See http://www.boost.org for updates, documentation, and revision history. Chris@102: Chris@102: // helper function templates for serialization of collections Chris@102: Chris@102: #include Chris@102: #include // size_t Chris@102: #include // msvc 6.0 needs this for warning suppression Chris@102: #if defined(BOOST_NO_STDC_NAMESPACE) Chris@102: namespace std{ Chris@102: using ::size_t; Chris@102: } // namespace std Chris@102: #endif Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: namespace boost{ Chris@102: namespace serialization { Chris@102: namespace stl { Chris@102: Chris@102: ////////////////////////////////////////////////////////////////////// Chris@102: // implementation of serialization for STL containers Chris@102: // Chris@102: template Chris@102: inline void load_unordered_collection(Archive & ar, Container &s) Chris@102: { Chris@102: collection_size_type count; Chris@102: collection_size_type bucket_count; Chris@102: boost::serialization::item_version_type item_version(0); Chris@102: boost::archive::library_version_type library_version( Chris@102: ar.get_library_version() Chris@102: ); Chris@102: // retrieve number of elements Chris@102: ar >> BOOST_SERIALIZATION_NVP(count); Chris@102: ar >> BOOST_SERIALIZATION_NVP(bucket_count); Chris@102: if(boost::archive::library_version_type(3) < library_version){ Chris@102: ar >> BOOST_SERIALIZATION_NVP(item_version); Chris@102: } Chris@102: s.clear(); Chris@102: s.rehash(bucket_count); Chris@102: InputFunction ifunc; Chris@102: while(count-- > 0){ Chris@102: ifunc(ar, s, item_version); Chris@102: } Chris@102: } Chris@102: Chris@102: } // namespace stl Chris@102: } // namespace serialization Chris@102: } // namespace boost Chris@102: Chris@102: #endif //BOOST_SERIALIZATION_UNORDERED_COLLECTIONS_LOAD_IMP_HPP