diff --git a/quicktex/util/ranges.h b/quicktex/util/ranges.h index d5611a7..82f52aa 100644 --- a/quicktex/util/ranges.h +++ b/quicktex/util/ranges.h @@ -94,6 +94,8 @@ template constexpr auto map(const Seq &input, Fn op) template class index_iterator_base { public: + friend D; + typedef long long difference_type; D &operator++() { @@ -146,10 +148,10 @@ template class index_iterator_base { auto &operator[](difference_type i) { return *(static_cast(*this) + i); } auto operator[](difference_type i) const { return *(static_cast(*this) + i); } - private: + protected: size_t _index; - friend D; + private: index_iterator_base(size_t index = 0) : _index(index) {} }; @@ -159,8 +161,6 @@ template class const_iterator : public index_iterator_base> { typedef long long difference_type; typedef range_value_t value_type; - friend base; - index_iterator() : base(0), _range(nullptr) {} index_iterator(R &range, size_t index) : base(index), _range(&range) {}