value_functors.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef BOOST_INTRUSIVE_DETAIL_VALUE_FUNCTORS_HPP
  2. #define BOOST_INTRUSIVE_DETAIL_VALUE_FUNCTORS_HPP
  3. ///////////////////////////////////////////////////////////////////////////////
  4. //
  5. // (C) Copyright Ion Gaztanaga 2017-2021. Distributed under the Boost
  6. // Software License, Version 1.0. (See accompanying file
  7. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/intrusive for documentation.
  10. //
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #if defined(BOOST_HAS_PRAGMA_ONCE)
  16. # pragma once
  17. #endif
  18. #include <cstddef>
  19. namespace boost {
  20. namespace intrusive {
  21. //Functors for member algorithm defaults
  22. template<class ValueType>
  23. struct value_less
  24. {
  25. bool operator()(const ValueType &a, const ValueType &b) const
  26. { return a < b; }
  27. };
  28. //Functors for member algorithm defaults
  29. template<class T>
  30. struct value_less<T*>
  31. {
  32. bool operator()(const T *a, const T* b) const
  33. { return std::size_t(a) < std::size_t(b); }
  34. };
  35. template<class ValueType>
  36. struct value_equal
  37. {
  38. bool operator()(const ValueType &a, const ValueType &b) const
  39. { return a == b; }
  40. };
  41. } //namespace intrusive {
  42. } //namespace boost {
  43. #endif //BOOST_INTRUSIVE_DETAIL_VALUE_FUNCTORS_HPP