1 | #ifndef BOOST_SERIALIZATION_PRIORITY_QUEUE_HPP |
2 | #define BOOST_SERIALIZATION_PRIORITY_QUEUE_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 | // priority_queue.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 <queue> |
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 Container, typename Compare> |
37 | struct priority_queue_save : public STD::priority_queue<U, Container, Compare> { |
38 | template<class Archive> |
39 | void operator()(Archive & ar, const unsigned int file_version) const { |
40 | save(ar, STD::priority_queue<U, Container, Compare>::c, file_version); |
41 | } |
42 | }; |
43 | template <typename U, typename Container, typename Compare> |
44 | struct priority_queue_load : public STD::priority_queue<U, Container, Compare> { |
45 | template<class Archive> |
46 | void operator()(Archive & ar, const unsigned int file_version) { |
47 | load(ar, STD::priority_queue<U, Container, Compare>::c, file_version); |
48 | } |
49 | }; |
50 | |
51 | } // detail |
52 | |
53 | template<class Archive, class T, class Container, class Compare> |
54 | inline void serialize( |
55 | Archive & ar, |
56 | std::priority_queue< T, Container, Compare> & t, |
57 | const unsigned int file_version |
58 | ){ |
59 | typedef typename mpl::eval_if< |
60 | typename Archive::is_saving, |
61 | mpl::identity<detail::priority_queue_save<T, Container, Compare> >, |
62 | mpl::identity<detail::priority_queue_load<T, Container, Compare> > |
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::priority_queue) |
73 | |
74 | #undef STD |
75 | |
76 | #endif // BOOST_SERIALIZATION_PRIORITY_QUEUE_HPP |
77 | |