fix doc example typo
[boost.git] / boost / serialization / hash_collections_load_imp.hpp
blobcd5bea8d1895e30cf3d7412cb124c29e15b49c0b
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)
6 # pragma once
7 # pragma warning (disable : 4786) // too long name, harmless warning
8 #endif
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/serialization/nvp.hpp>
23 #include <boost/serialization/collections_load_imp.hpp>
25 namespace boost{
26 namespace serialization {
27 namespace stl {
29 //////////////////////////////////////////////////////////////////////
30 // implementation of serialization for STL containers
32 template<class Archive, class Container, class InputFunction>
33 inline void load_hash_collection(Archive & ar, Container &s)
35 s.clear();
36 // retrieve number of elements
37 unsigned int count;
38 unsigned int item_version(0);
39 unsigned int bucket_count;;
40 ar >> BOOST_SERIALIZATION_NVP(count);
41 if(3 < ar.get_library_version()){
42 ar >> BOOST_SERIALIZATION_NVP(bucket_count);
43 ar >> BOOST_SERIALIZATION_NVP(item_version);
45 #if ! defined(__MWERKS__)
46 s.resize(bucket_count);
47 #endif
48 InputFunction ifunc;
49 while(count-- > 0){
50 ifunc(ar, s, item_version);
54 } // namespace stl
55 } // namespace serialization
56 } // namespace boost
58 #endif //BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP