1 #ifndef BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP
2 #define BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma warning (disable : 4786) // too long name, harmless warning
10 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
11 // hash_collections_load_imp.hpp: serialization for loading stl collections
13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
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)
18 // See http://www.boost.org for updates, documentation, and revision history.
20 // helper function templates for serialization of hashed collections
21 #include <boost/config.hpp>
22 #include <boost/archive/detail/basic_iarchive.hpp>
23 #include <boost/serialization/nvp.hpp>
24 #include <boost/serialization/collection_size_type.hpp>
25 #include <boost/serialization/item_version_type.hpp>
28 namespace serialization {
31 //////////////////////////////////////////////////////////////////////
32 // implementation of serialization for STL containers
34 template<class Archive, class Container, class InputFunction>
35 inline void load_hash_collection(Archive & ar, Container &s)
38 collection_size_type count;
39 collection_size_type bucket_count;
40 boost::serialization::item_version_type item_version(0);
41 boost::archive::library_version_type library_version(
42 ar.get_library_version()
44 // retrieve number of elements
45 if(boost::archive::library_version_type(6) != library_version){
46 ar >> BOOST_SERIALIZATION_NVP(count);
47 ar >> BOOST_SERIALIZATION_NVP(bucket_count);
50 // note: fixup for error in version 6. collection size was
51 // changed to size_t BUT for hashed collections it was implemented
52 // as an unsigned int. This should be a problem only on win64 machines
53 // but I'll leave it for everyone just in case.
56 ar >> BOOST_SERIALIZATION_NVP(c);
58 ar >> BOOST_SERIALIZATION_NVP(bc);
61 if(boost::archive::library_version_type(3) < library_version){
62 ar >> BOOST_SERIALIZATION_NVP(item_version);
64 #if ! defined(__MWERKS__)
65 s.resize(bucket_count);
69 ifunc(ar, s, item_version);
74 } // namespace serialization
77 #endif //BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP