comparable.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*-----------------------------------------------------------------------------+
  2. Copyright (c) 2010-2010: Joachim Faulhaber
  3. +------------------------------------------------------------------------------+
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENCE.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. +-----------------------------------------------------------------------------*/
  8. #ifndef BOOST_ICL_CONCEPT_COMPARABLE_HPP_JOFA_100921
  9. #define BOOST_ICL_CONCEPT_COMPARABLE_HPP_JOFA_100921
  10. #include <boost/utility/enable_if.hpp>
  11. #include <boost/icl/type_traits/is_icl_container.hpp>
  12. namespace boost{ namespace icl
  13. {
  14. //==============================================================================
  15. //= Equivalences and Orderings<Comparable>
  16. //==============================================================================
  17. template<class Type>
  18. inline typename enable_if<is_icl_container<Type>, bool>::type
  19. operator != (const Type& left, const Type& right)
  20. { return !(left == right); }
  21. template<class Type>
  22. inline typename enable_if<is_icl_container<Type>, bool>::type
  23. operator > (const Type& left, const Type& right)
  24. { return right < left; }
  25. /** Partial ordering which is induced by Compare */
  26. template<class Type>
  27. inline typename enable_if<is_icl_container<Type>, bool>::type
  28. operator <= (const Type& left, const Type& right)
  29. { return !(left > right); }
  30. template<class Type>
  31. inline typename enable_if<is_icl_container<Type>, bool>::type
  32. operator >= (const Type& left, const Type& right)
  33. { return !(left < right); }
  34. }} // namespace boost icl
  35. #endif