comparison DEPENDENCIES/generic/include/boost/serialization/list.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_LIST_HPP 1 #ifndef BOOST_SERIALIZATION_LIST_HPP
2 #define BOOST_SERIALIZATION_LIST_HPP 2 #define BOOST_SERIALIZATION_LIST_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 // list.hpp: serialization for stl list templates 10 // list.hpp: serialization for stl list templates
19 #include <list> 19 #include <list>
20 20
21 #include <boost/config.hpp> 21 #include <boost/config.hpp>
22 22
23 #include <boost/serialization/collections_save_imp.hpp> 23 #include <boost/serialization/collections_save_imp.hpp>
24 #include <boost/serialization/collections_load_imp.hpp> 24
25 #include <boost/archive/detail/basic_iarchive.hpp>
26 #include <boost/serialization/access.hpp>
27 #include <boost/serialization/nvp.hpp>
28 #include <boost/serialization/collection_size_type.hpp>
29 #include <boost/serialization/item_version_type.hpp>
25 #include <boost/serialization/split_free.hpp> 30 #include <boost/serialization/split_free.hpp>
31 #include <boost/serialization/detail/stack_constructor.hpp>
32 #include <boost/serialization/detail/is_default_constructible.hpp>
26 33
27 namespace boost { 34 namespace boost {
28 namespace serialization { 35 namespace serialization {
29 36
30 template<class Archive, class U, class Allocator> 37 template<class Archive, class U, class Allocator>
43 inline void load( 50 inline void load(
44 Archive & ar, 51 Archive & ar,
45 std::list<U, Allocator> &t, 52 std::list<U, Allocator> &t,
46 const unsigned int /* file_version */ 53 const unsigned int /* file_version */
47 ){ 54 ){
48 boost::serialization::stl::load_collection< 55 const boost::archive::library_version_type library_version(
49 Archive, 56 ar.get_library_version()
50 std::list<U, Allocator>, 57 );
51 boost::serialization::stl::archive_input_seq< 58 // retrieve number of elements
52 Archive, 59 item_version_type item_version(0);
53 std::list<U, Allocator> 60 collection_size_type count;
54 >, 61 ar >> BOOST_SERIALIZATION_NVP(count);
55 boost::serialization::stl::no_reserve_imp<std::list<U, Allocator> > 62 if(boost::archive::library_version_type(3) < library_version){
56 >(ar, t); 63 ar >> BOOST_SERIALIZATION_NVP(item_version);
64 }
65 if(detail::is_default_constructible<U>()){
66 t.resize(count);
67 typename std::list<U, Allocator>::iterator hint;
68 hint = t.begin();
69 while(count-- > 0){
70 ar >> boost::serialization::make_nvp("item", *hint++);
71 }
72 }
73 else{
74 t.clear();
75 while(count-- > 0){
76 detail::stack_construct<Archive, U> u(ar, item_version);
77 ar >> boost::serialization::make_nvp("item", u.reference());
78 t.push_back(u.reference());
79 ar.reset_object_address(& t.back() , & u.reference());
80 }
81 }
57 } 82 }
58 83
59 // split non-intrusive serialization function member into separate 84 // split non-intrusive serialization function member into separate
60 // non intrusive save/load member functions 85 // non intrusive save/load member functions
61 template<class Archive, class U, class Allocator> 86 template<class Archive, class U, class Allocator>