rel_ops.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef _LIBCPP___UTILITY_REL_OPS_H
  9. #define _LIBCPP___UTILITY_REL_OPS_H
  10. #include <__config>
  11. #include <__utility/forward.h>
  12. #include <__utility/move.h>
  13. #include <type_traits>
  14. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  15. # pragma GCC system_header
  16. #endif
  17. _LIBCPP_BEGIN_NAMESPACE_STD
  18. namespace rel_ops
  19. {
  20. template<class _Tp>
  21. inline _LIBCPP_INLINE_VISIBILITY
  22. bool
  23. operator!=(const _Tp& __x, const _Tp& __y)
  24. {
  25. return !(__x == __y);
  26. }
  27. template<class _Tp>
  28. inline _LIBCPP_INLINE_VISIBILITY
  29. bool
  30. operator> (const _Tp& __x, const _Tp& __y)
  31. {
  32. return __y < __x;
  33. }
  34. template<class _Tp>
  35. inline _LIBCPP_INLINE_VISIBILITY
  36. bool
  37. operator<=(const _Tp& __x, const _Tp& __y)
  38. {
  39. return !(__y < __x);
  40. }
  41. template<class _Tp>
  42. inline _LIBCPP_INLINE_VISIBILITY
  43. bool
  44. operator>=(const _Tp& __x, const _Tp& __y)
  45. {
  46. return !(__x < __y);
  47. }
  48. } // namespace rel_ops
  49. _LIBCPP_END_NAMESPACE_STD
  50. #endif // _LIBCPP___UTILITY_REL_OPS_H