priority_compare.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP
  13. #define BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP
  14. #include <boost/intrusive/detail/config_begin.hpp>
  15. #include <boost/intrusive/detail/workaround.hpp>
  16. #include <boost/intrusive/intrusive_fwd.hpp>
  17. #include <boost/intrusive/detail/minimal_less_equal_header.hpp>
  18. #if defined(BOOST_HAS_PRAGMA_ONCE)
  19. # pragma once
  20. #endif
  21. namespace boost {
  22. namespace intrusive {
  23. template <class T>
  24. struct priority_compare
  25. {
  26. //Compatibility with std::binary_function
  27. typedef T first_argument_type;
  28. typedef T second_argument_type;
  29. typedef bool result_type;
  30. BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T &val, const T &val2) const
  31. {
  32. return priority_order(val, val2);
  33. }
  34. };
  35. /// @cond
  36. template<class PrioComp, class T>
  37. struct get_prio
  38. {
  39. typedef PrioComp type;
  40. };
  41. template<class T>
  42. struct get_prio<void, T>
  43. {
  44. typedef ::boost::intrusive::priority_compare<T> type;
  45. };
  46. /// @endcond
  47. } //namespace intrusive
  48. } //namespace boost
  49. #include <boost/intrusive/detail/config_end.hpp>
  50. #endif //BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP