comparison DEPENDENCIES/generic/include/boost/serialization/collections_save_imp.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
1 #ifndef BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP 1 #ifndef BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP
2 #define BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP 2 #define BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP
3 3
4 // MS compatible compilers support #pragma once 4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020) 5 #if defined(_MSC_VER)
6 # pragma once 6 # pragma once
7 #endif 7 #endif
8 8
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // collections_save_imp.hpp: serialization for stl collections 10 // collections_save_imp.hpp: serialization for stl collections
32 ////////////////////////////////////////////////////////////////////// 32 //////////////////////////////////////////////////////////////////////
33 // implementation of serialization for STL containers 33 // implementation of serialization for STL containers
34 // 34 //
35 35
36 template<class Archive, class Container> 36 template<class Archive, class Container>
37 inline void save_collection(Archive & ar, const Container &s) 37 inline void save_collection(
38 Archive & ar,
39 const Container &s,
40 collection_size_type count)
38 { 41 {
42 ar << BOOST_SERIALIZATION_NVP(count);
39 // record number of elements 43 // record number of elements
40 collection_size_type count(s.size());
41 const item_version_type item_version( 44 const item_version_type item_version(
42 version<BOOST_DEDUCED_TYPENAME Container::value_type>::value 45 version<typename Container::value_type>::value
43 ); 46 );
44 ar << BOOST_SERIALIZATION_NVP(count);
45 #if 0 47 #if 0
46 boost::archive::library_version_type library_version( 48 boost::archive::library_version_type library_version(
47 ar.get_library_version() 49 ar.get_library_version()
48 ); 50 );
49 if(boost::archive::library_version_type(3) < library_version){ 51 if(boost::archive::library_version_type(3) < library_version){
51 } 53 }
52 #else 54 #else
53 ar << BOOST_SERIALIZATION_NVP(item_version); 55 ar << BOOST_SERIALIZATION_NVP(item_version);
54 #endif 56 #endif
55 57
56 BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin(); 58 typename Container::const_iterator it = s.begin();
57 while(count-- > 0){ 59 while(count-- > 0){
58 // note borland emits a no-op without the explicit namespace 60 // note borland emits a no-op without the explicit namespace
59 boost::serialization::save_construct_data_adl( 61 boost::serialization::save_construct_data_adl(
60 ar, 62 ar,
61 &(*it), 63 &(*it),
63 ); 65 );
64 ar << boost::serialization::make_nvp("item", *it++); 66 ar << boost::serialization::make_nvp("item", *it++);
65 } 67 }
66 } 68 }
67 69
70 template<class Archive, class Container>
71 inline void save_collection(Archive & ar, const Container &s)
72 {
73 // record number of elements
74 collection_size_type count(s.size());
75 save_collection(ar, s, count);
76 }
77
68 } // namespace stl 78 } // namespace stl
69 } // namespace serialization 79 } // namespace serialization
70 } // namespace boost 80 } // namespace boost
71 81
72 #endif //BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP 82 #endif //BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP