priority_compare.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/intrusive_fwd.hpp>
  16. #include <functional>
  17. namespace boost {
  18. namespace intrusive {
  19. template <class T>
  20. struct priority_compare
  21. : public std::binary_function<T, T, bool>
  22. {
  23. bool operator()(const T &val, const T &val2) const
  24. {
  25. return priority_order(val, val2);
  26. }
  27. };
  28. /// @cond
  29. template<class Less, class T>
  30. struct get_prio
  31. {
  32. typedef Less type;
  33. };
  34. template<class T>
  35. struct get_prio<void, T>
  36. {
  37. typedef ::boost::intrusive::priority_compare<T> type;
  38. };
  39. /// @endcond
  40. } //namespace intrusive
  41. } //namespace boost
  42. #include <boost/intrusive/detail/config_end.hpp>
  43. #endif //BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP