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
22// function specializations must be defined in the appropriate
23// namespace - boost::serialization
24#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
25#define STD _STLP_STD
26#else
27#define STD std
28#endif
29
30namespace boost {
31namespace serialization {
32namespace detail{
33
34template <typename U, typename C>
35struct stack_save : public STD::stack<U, C> {
36 template<class Archive>
37 void operator()(Archive & ar, const unsigned int file_version) const {
38 save(ar, STD::stack<U, C>::c, file_version);
39 }
40};
41template <typename U, typename C>
42struct stack_load : public STD::stack<U, C> {
43 template<class Archive>
44 void operator()(Archive & ar, const unsigned int file_version) {
45 load(ar, STD::stack<U, C>::c, file_version);
46 }
47};
48
49} // detail
50
51template<class Archive, class T, class C>
52inline void serialize(
53 Archive & ar,
54 std::stack< T, C> & t,
55 const unsigned int file_version
56){
57 typedef typename mpl::eval_if<
58 typename Archive::is_saving,
59 mpl::identity<detail::stack_save<T, C> >,
60 mpl::identity<detail::stack_load<T, C> >
61 >::type typex;
62 static_cast<typex &>(t)(ar, file_version);
63}
64
65} // namespace serialization
66} // namespace boost
67
68#include <boost/serialization/collection_traits.hpp>
69
70BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::stack)
71
72#undef STD
73
74#endif // BOOST_SERIALIZATION_DEQUE_HPP
75

source code of boost/boost/serialization/stack.hpp