// // iota_iterator.h // stream // // Created by Sam Jaffe on 4/6/23. // #pragma once #include #include #include #include namespace stream::ranges { template class iota_iterator : public facade, iterator::category::random_access> { public: using sentinal_type = std::conditional_t, void, Bound>; iota_iterator() = default; iota_iterator(T value) : value_(value) {} T dereference() const { return value_; } void advance(std::ptrdiff_t off) { value_ += off; } std::ptrdiff_t distance_to(iota_iterator const & other) const { return other.value_ - value_; } SFINAE((detail::is_sized_sentinel_v)) friend bool operator-(Bound bound, iota_iterator const & self) { return bound - self.value_; } private: T value_; }; } #include