util/DereferenceIterator, TerminatedArray: added operator-(const IteratorType&) to DereferenceIterator and TerminatedArray::iterator
It is required by std::distance and some std algos.
This commit is contained in:
parent
ab011adf77
commit
93bf99f639
@ -82,6 +82,10 @@ public:
|
||||
return DereferenceIterator{original - n};
|
||||
}
|
||||
|
||||
constexpr auto operator-(const DereferenceIterator<IT, VT>& other) const noexcept {
|
||||
return std::distance(other.original, original);
|
||||
}
|
||||
|
||||
/* this is a template to allow comparisons with sentinel end
|
||||
iterators */
|
||||
template<typename IT2>
|
||||
|
@ -101,6 +101,10 @@ public:
|
||||
return iterator{cursor - n};
|
||||
}
|
||||
|
||||
constexpr auto operator-(const iterator& other) const noexcept {
|
||||
return std::distance(other.cursor, cursor);
|
||||
}
|
||||
|
||||
reference operator*() const noexcept {
|
||||
return *cursor;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user