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