1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // |
3 | // (C) Copyright Ion Gaztanaga 2008 |
4 | // |
5 | // Distributed under the Boost Software License, Version 1.0. |
6 | // (See accompanying file LICENSE_1_0.txt or copy at |
7 | // http://www.boost.org/LICENSE_1_0.txt) |
8 | // |
9 | // See http://www.boost.org/libs/intrusive for documentation. |
10 | // |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | |
13 | #ifndef BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP |
14 | #define BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP |
15 | |
16 | #include <boost/intrusive/detail/config_begin.hpp> |
17 | #include <boost/intrusive/intrusive_fwd.hpp> |
18 | |
19 | #include <boost/intrusive/detail/minimal_less_equal_header.hpp> |
20 | |
21 | #if defined(BOOST_HAS_PRAGMA_ONCE) |
22 | # pragma once |
23 | #endif |
24 | |
25 | namespace boost { |
26 | namespace intrusive { |
27 | |
28 | template <class T> |
29 | struct priority_compare |
30 | { |
31 | //Compatibility with std::binary_function |
32 | typedef T first_argument_type; |
33 | typedef T second_argument_type; |
34 | typedef bool result_type; |
35 | |
36 | bool operator()(const T &val, const T &val2) const |
37 | { |
38 | return priority_order(val, val2); |
39 | } |
40 | }; |
41 | |
42 | /// @cond |
43 | |
44 | template<class Less, class T> |
45 | struct get_prio |
46 | { |
47 | typedef Less type; |
48 | }; |
49 | |
50 | |
51 | template<class T> |
52 | struct get_prio<void, T> |
53 | { |
54 | typedef ::boost::intrusive::priority_compare<T> type; |
55 | }; |
56 | |
57 | /// @endcond |
58 | |
59 | } //namespace intrusive |
60 | } //namespace boost |
61 | |
62 | #include <boost/intrusive/detail/config_end.hpp> |
63 | |
64 | #endif //BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP |
65 | |