]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/serialization/stack.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / serialization / stack.hpp
1 #ifndef BOOST_SERIALIZATION_STACK_HPP
2 #define BOOST_SERIALIZATION_STACK_HPP
3
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
8
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // stack.hpp
11
12 // (C) Copyright 2014 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 <stack>
20 #include <boost/config.hpp>
21 #include <boost/mpl/eval_if.hpp>
22 #include <boost/mpl/identity.hpp>
23
24 // function specializations must be defined in the appropriate
25 // namespace - boost::serialization
26 #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
27 #define STD _STLP_STD
28 #else
29 #define STD std
30 #endif
31
32 namespace boost {
33 namespace serialization {
34 namespace detail{
35
36 template <typename U, typename C>
37 struct stack_save : public STD::stack<U, C> {
38 template<class Archive>
39 void operator()(Archive & ar, const unsigned int file_version) const {
40 save(ar, STD::stack<U, C>::c, file_version);
41 }
42 };
43 template <typename U, typename C>
44 struct stack_load : public STD::stack<U, C> {
45 template<class Archive>
46 void operator()(Archive & ar, const unsigned int file_version) {
47 load(ar, STD::stack<U, C>::c, file_version);
48 }
49 };
50
51 } // detail
52
53 template<class Archive, class T, class C>
54 inline void serialize(
55 Archive & ar,
56 std::stack< T, C> & t,
57 const unsigned int file_version
58 ){
59 typedef typename mpl::eval_if<
60 typename Archive::is_saving,
61 mpl::identity<detail::stack_save<T, C> >,
62 mpl::identity<detail::stack_load<T, C> >
63 >::type typex;
64 static_cast<typex &>(t)(ar, file_version);
65 }
66
67 } // namespace serialization
68 } // namespace boost
69
70 #include <boost/serialization/collection_traits.hpp>
71
72 BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::stack)
73
74 #undef STD
75
76 #endif // BOOST_SERIALIZATION_DEQUE_HPP