You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

infinity.hpp 1.8KB

5 vuotta sitten
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Range v3 library
  2. //
  3. // Copyright Eric Niebler 2014-present
  4. //
  5. // Use, modification and distribution is subject to the
  6. // Boost Software License, Version 1.0. (See accompanying
  7. // file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // Project home: https://github.com/ericniebler/range-v3
  11. //
  12. #ifndef RANGES_V3_UTILITY_INFINITY_HPP
  13. #define RANGES_V3_UTILITY_INFINITY_HPP
  14. #include <concepts/concepts.hpp>
  15. #include <range/v3/range_fwd.hpp>
  16. RANGES_DEPRECATED_HEADER(
  17. "This header is deprecated and will be removed from a future version of range-v3.")
  18. namespace ranges
  19. {
  20. /// \cond
  21. struct infinity
  22. {
  23. friend constexpr bool operator==(infinity, infinity)
  24. {
  25. return true;
  26. }
  27. friend constexpr bool operator!=(infinity, infinity)
  28. {
  29. return false;
  30. }
  31. template<typename Integer>
  32. friend constexpr auto operator==(Integer, infinity) noexcept
  33. -> CPP_broken_friend_ret(bool)( //
  34. requires integral<Integer>)
  35. {
  36. return false;
  37. }
  38. template<typename Integer>
  39. friend constexpr auto operator==(infinity, Integer) noexcept
  40. -> CPP_broken_friend_ret(bool)( //
  41. requires integral<Integer>)
  42. {
  43. return false;
  44. }
  45. template<typename Integer>
  46. friend constexpr auto operator!=(Integer, infinity) noexcept
  47. -> CPP_broken_friend_ret(bool)( //
  48. requires integral<Integer>)
  49. {
  50. return true;
  51. }
  52. template<typename Integer>
  53. friend constexpr auto operator!=(infinity, Integer) noexcept
  54. -> CPP_broken_friend_ret(bool)( //
  55. requires integral<Integer>)
  56. {
  57. return true;
  58. }
  59. };
  60. /// \endcond
  61. } // namespace ranges
  62. #endif