1 | #ifndef BOOST_SERIALIZATION_DEQUE_HPP |
2 | #define BOOST_SERIALIZATION_DEQUE_HPP |
3 | |
4 | // MS compatible compilers support #pragma once |
5 | #if defined(_MSC_VER) |
6 | # pragma once |
7 | #endif |
8 | |
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
10 | // deque.hpp |
11 | |
12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
13 | // Use, modification and distribution is subject to the Boost Software |
14 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
15 | // http://www.boost.org/LICENSE_1_0.txt) |
16 | |
17 | // See http://www.boost.org for updates, documentation, and revision history. |
18 | |
19 | #include <deque> |
20 | |
21 | #include <boost/config.hpp> |
22 | |
23 | #include <boost/serialization/library_version_type.hpp> |
24 | #include <boost/serialization/collections_save_imp.hpp> |
25 | #include <boost/serialization/collections_load_imp.hpp> |
26 | #include <boost/serialization/split_free.hpp> |
27 | |
28 | namespace boost { |
29 | namespace serialization { |
30 | |
31 | template<class Archive, class U, class Allocator> |
32 | inline void save( |
33 | Archive & ar, |
34 | const std::deque<U, Allocator> &t, |
35 | const unsigned int /* file_version */ |
36 | ){ |
37 | boost::serialization::stl::save_collection< |
38 | Archive, std::deque<U, Allocator> |
39 | >(ar, t); |
40 | } |
41 | |
42 | template<class Archive, class U, class Allocator> |
43 | inline void load( |
44 | Archive & ar, |
45 | std::deque<U, Allocator> &t, |
46 | const unsigned int /* file_version */ |
47 | ){ |
48 | const boost::serialization::library_version_type library_version( |
49 | ar.get_library_version() |
50 | ); |
51 | // retrieve number of elements |
52 | item_version_type item_version(0); |
53 | collection_size_type count; |
54 | ar >> BOOST_SERIALIZATION_NVP(count); |
55 | if(boost::serialization::library_version_type(3) < library_version){ |
56 | ar >> BOOST_SERIALIZATION_NVP(item_version); |
57 | } |
58 | stl::collection_load_impl(ar, t, count, item_version); |
59 | } |
60 | |
61 | // split non-intrusive serialization function member into separate |
62 | // non intrusive save/load member functions |
63 | template<class Archive, class U, class Allocator> |
64 | inline void serialize( |
65 | Archive & ar, |
66 | std::deque<U, Allocator> &t, |
67 | const unsigned int file_version |
68 | ){ |
69 | boost::serialization::split_free(ar, t, file_version); |
70 | } |
71 | |
72 | } // namespace serialization |
73 | } // namespace boost |
74 | |
75 | #include <boost/serialization/collection_traits.hpp> |
76 | |
77 | BOOST_SERIALIZATION_COLLECTION_TRAITS(std::deque) |
78 | |
79 | #endif // BOOST_SERIALIZATION_DEQUE_HPP |
80 | |