change iterator friends to members
This commit is contained in:
@ -15,6 +15,8 @@ namespace bse {
|
|||||||
|
|
||||||
AbstractIterator(T* ptr) : ptr(ptr) {}
|
AbstractIterator(T* ptr) : ptr(ptr) {}
|
||||||
|
|
||||||
|
virtual AbstractIterator& operator++() = 0;
|
||||||
|
|
||||||
T* operator->() { return this->ptr; }
|
T* operator->() { return this->ptr; }
|
||||||
T& operator*() { return *this->ptr; }
|
T& operator*() { return *this->ptr; }
|
||||||
bool operator==(const AbstractIterator& other) const { return this->ptr == other.ptr; }
|
bool operator==(const AbstractIterator& other) const { return this->ptr == other.ptr; }
|
||||||
@ -35,24 +37,19 @@ namespace bse {
|
|||||||
|
|
||||||
ContinuousIterator(T* ptr) : AbstractIterator<T>(ptr) {}
|
ContinuousIterator(T* ptr) : AbstractIterator<T>(ptr) {}
|
||||||
|
|
||||||
friend ContinuousIterator& operator++(ContinuousIterator& rhs) {
|
ContinuousIterator& operator++() override {
|
||||||
++rhs.ptr;
|
++this->ptr;
|
||||||
return rhs;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend ContinuousIterator& operator--(ContinuousIterator& rhs) {
|
ContinuousIterator operator+(std::size_t add) {
|
||||||
--rhs.ptr;
|
this->ptr += add;
|
||||||
return rhs;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend ContinuousIterator operator+(ContinuousIterator lhs, std::size_t add) {
|
ContinuousIterator operator-(std::size_t sub) {
|
||||||
lhs.ptr += add;
|
this->ptr -= sub;
|
||||||
return lhs;
|
return *this;
|
||||||
}
|
|
||||||
|
|
||||||
friend ContinuousIterator operator-(ContinuousIterator lhs, std::size_t sub) {
|
|
||||||
lhs.ptr -= sub;
|
|
||||||
return lhs;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user