Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

67 lines
1.9KB

  1. /// \file
  2. // Range v3 library
  3. //
  4. // Copyright Eric Niebler 2014-present
  5. //
  6. // Use, modification and distribution is subject to the
  7. // Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // Project home: https://github.com/ericniebler/range-v3
  12. //
  13. #ifndef RANGES_V3_ITERATOR_UNREACHABLE_SENTINEL_HPP
  14. #define RANGES_V3_ITERATOR_UNREACHABLE_SENTINEL_HPP
  15. #include <range/v3/range_fwd.hpp>
  16. #include <range/v3/iterator/concepts.hpp>
  17. namespace ranges
  18. {
  19. /// \addtogroup group-iterator
  20. /// @{
  21. struct unreachable_sentinel_t
  22. {
  23. template<typename I>
  24. friend constexpr auto operator==(I const &, unreachable_sentinel_t) noexcept
  25. -> CPP_broken_friend_ret(bool)( //
  26. requires weakly_incrementable<I>)
  27. {
  28. return false;
  29. }
  30. template<typename I>
  31. friend constexpr auto operator==(unreachable_sentinel_t, I const &) noexcept
  32. -> CPP_broken_friend_ret(bool)( //
  33. requires weakly_incrementable<I>)
  34. {
  35. return false;
  36. }
  37. template<typename I>
  38. friend constexpr auto operator!=(I const &, unreachable_sentinel_t) noexcept
  39. -> CPP_broken_friend_ret(bool)( //
  40. requires weakly_incrementable<I>)
  41. {
  42. return true;
  43. }
  44. template<typename I>
  45. friend constexpr auto operator!=(unreachable_sentinel_t, I const &) noexcept
  46. -> CPP_broken_friend_ret(bool)( //
  47. requires weakly_incrementable<I>)
  48. {
  49. return true;
  50. }
  51. };
  52. RANGES_INLINE_VARIABLE(unreachable_sentinel_t, unreachable)
  53. namespace cpp20
  54. {
  55. using ranges::unreachable;
  56. using ranges::unreachable_sentinel_t;
  57. } // namespace cpp20
  58. /// @}
  59. } // namespace ranges
  60. #endif // RANGES_V3_ITERATOR_UNREACHABLE_SENTINEL_HPP