Why doesn't the iterator below satisfy std::input_iterator concept? What did I miss?
template <class T>
struct IteratorSentinel {};
template <class T>
class Iterator
{
public:
using iterator_category = std::input_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
Iterator() = default;
Iterator(const Iterator&) = delete;
Iterator& operator = (const Iterator&) = delete;
Iterator(Iterator&& other) = default;
Iterator& operator = (Iterator&& other) = default;
T* operator-> ();
T& operator* ();
bool operator== (const IteratorSentinel<T>&) const noexcept;
Iterator& operator++ ();
void operator++ (int);
};
The following static assertion fails:
static_assert(std::input_iterator<Iterator<int>>);
And, for example, the code below does not compile:
template <class T>
auto make_range()
{
return std::ranges::subrange(Iterator<T>(), IteratorSentinel<T>{});
}
std::ranges::equal(make_range<int>(), std::vector<int>());
constraints not satisfied for alias template 'iter_reference_t' [with _Tp = const Iterator<int>], meaningoperator*must work even on const iterators.