]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/serialization/collections_load_imp.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / serialization / collections_load_imp.hpp
CommitLineData
7c673cae
FG
1#ifndef BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
2#define BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER)
6# pragma once
7#endif
8
9#if defined(_MSC_VER) && (_MSC_VER <= 1020)
10# pragma warning (disable : 4786) // too long name, harmless warning
11#endif
12
13/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
14// collections_load_imp.hpp: serialization for loading stl collections
15
f67539c2 16// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
7c673cae
FG
17// Use, modification and distribution is subject to the Boost Software
18// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
19// http://www.boost.org/LICENSE_1_0.txt)
20
21// See http://www.boost.org for updates, documentation, and revision history.
22
23// helper function templates for serialization of collections
24
25#include <boost/assert.hpp>
26#include <cstddef> // size_t
27#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
28#if defined(BOOST_NO_STDC_NAMESPACE)
f67539c2
TL
29namespace std{
30 using ::size_t;
7c673cae
FG
31} // namespace std
32#endif
33#include <boost/detail/workaround.hpp>
34
35#include <boost/archive/detail/basic_iarchive.hpp>
36#include <boost/serialization/access.hpp>
37#include <boost/serialization/nvp.hpp>
38#include <boost/serialization/detail/stack_constructor.hpp>
39#include <boost/serialization/collection_size_type.hpp>
40#include <boost/serialization/item_version_type.hpp>
41#include <boost/serialization/detail/is_default_constructible.hpp>
42#include <boost/utility/enable_if.hpp>
b32b8144 43#include <boost/move/utility_core.hpp>
7c673cae
FG
44
45namespace boost{
46namespace serialization {
47namespace stl {
48
49//////////////////////////////////////////////////////////////////////
50// implementation of serialization for STL containers
51//
52
53template<
54 class Archive,
55 class T
56>
57typename boost::enable_if<
58 typename detail::is_default_constructible<
59 typename T::value_type
60 >,
61 void
62>::type
63collection_load_impl(
64 Archive & ar,
65 T & t,
66 collection_size_type count,
b32b8144 67 item_version_type /*item_version*/
7c673cae
FG
68){
69 t.resize(count);
70 typename T::iterator hint;
71 hint = t.begin();
72 while(count-- > 0){
73 ar >> boost::serialization::make_nvp("item", *hint++);
74 }
75}
76
77template<
78 class Archive,
79 class T
80>
81typename boost::disable_if<
82 typename detail::is_default_constructible<
83 typename T::value_type
84 >,
85 void
86>::type
87collection_load_impl(
88 Archive & ar,
89 T & t,
90 collection_size_type count,
91 item_version_type item_version
92){
93 t.clear();
94 while(count-- > 0){
95 detail::stack_construct<Archive, typename T::value_type> u(ar, item_version);
96 ar >> boost::serialization::make_nvp("item", u.reference());
b32b8144 97 t.push_back(boost::move(u.reference()));
f67539c2 98 ar.reset_object_address(& t.back() , u.address());
7c673cae
FG
99 }
100}
101
f67539c2 102} // namespace stl
7c673cae
FG
103} // namespace serialization
104} // namespace boost
105
106#endif //BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP