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/detail/workaround.hpp> 18 #include <boost/intrusive/intrusive_fwd.hpp> 19 20 #include <boost/intrusive/detail/minimal_less_equal_header.hpp> 21 22 #if defined(BOOST_HAS_PRAGMA_ONCE) 23 # pragma once 24 #endif 25 26 namespace boost { 27 namespace intrusive { 28 29 /// @cond 30 31 template<class U> 32 void priority_order(); 33 34 /// @endcond 35 36 template <class T = void> 37 struct priority_compare 38 { 39 //Compatibility with std::binary_function 40 typedef T first_argument_type; 41 typedef T second_argument_type; 42 typedef bool result_type; 43 operator ()boost::intrusive::priority_compare44 BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T &val, const T &val2) const 45 { 46 return priority_order(val, val2); 47 } 48 }; 49 50 template <> 51 struct priority_compare<void> 52 { 53 template<class T, class U> operator ()boost::intrusive::priority_compare54 BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T &t, const U &u) const 55 { 56 return priority_order(t, u); 57 } 58 }; 59 60 /// @cond 61 62 template<class PrioComp, class T> 63 struct get_prio 64 { 65 typedef PrioComp type; 66 }; 67 68 69 template<class T> 70 struct get_prio<void, T> 71 { 72 typedef ::boost::intrusive::priority_compare<T> type; 73 }; 74 75 /// @endcond 76 77 } //namespace intrusive 78 } //namespace boost 79 80 #include <boost/intrusive/detail/config_end.hpp> 81 82 #endif //BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP 83