]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
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 | ||
30 | namespace boost { | |
31 | namespace serialization { | |
32 | namespace detail{ | |
33 | ||
34 | template <typename U, typename Container, typename Compare> | |
35 | struct priority_queue_save : public STD::priority_queue<U, Container, Compare> { | |
36 | template<class Archive> | |
37 | void operator()(Archive & ar, const unsigned int file_version) const { | |
38 | save(ar, STD::priority_queue<U, Container, Compare>::c, file_version); | |
39 | } | |
40 | }; | |
41 | template <typename U, typename Container, typename Compare> | |
42 | struct priority_queue_load : public STD::priority_queue<U, Container, Compare> { | |
43 | template<class Archive> | |
44 | void operator()(Archive & ar, const unsigned int file_version) { | |
45 | load(ar, STD::priority_queue<U, Container, Compare>::c, file_version); | |
46 | } | |
47 | }; | |
48 | ||
49 | } // detail | |
50 | ||
51 | template<class Archive, class T, class Container, class Compare> | |
52 | inline void serialize( | |
53 | Archive & ar, | |
54 | std::priority_queue< T, Container, Compare> & t, | |
55 | const unsigned int file_version | |
56 | ){ | |
57 | typedef typename mpl::eval_if< | |
58 | typename Archive::is_saving, | |
59 | mpl::identity<detail::priority_queue_save<T, Container, Compare> >, | |
60 | mpl::identity<detail::priority_queue_load<T, Container, Compare> > | |
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 | ||
70 | BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::priority_queue) | |
71 | ||
72 | #undef STD | |
73 | ||
74 | #endif // BOOST_SERIALIZATION_PRIORITY_QUEUE_HPP |