sentinal.h 450 B

12345678910111213141516171819202122232425
  1. //
  2. // sentinal.h
  3. // stream
  4. //
  5. // Created by Sam Jaffe on 3/30/23.
  6. //
  7. #pragma once
  8. namespace stream::detail {
  9. struct sentinal_type {
  10. template <typename It>
  11. friend bool operator==(It const & iter, sentinal_type) {
  12. return iter.at_end();
  13. }
  14. template <typename It>
  15. friend bool operator!=(It const & iter, sentinal_type) {
  16. return !iter.at_end();
  17. }
  18. };
  19. }
  20. namespace stream::ranges {
  21. constexpr inline detail::sentinal_type sentinal;
  22. }