Skip to content

Commit

Permalink
Add postfix increment operator
Browse files Browse the repository at this point in the history
  • Loading branch information
afabri committed Sep 12, 2024
1 parent 2c53d06 commit 213063f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/geometrycentral/utilities/element_iterators.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class RangeIteratorBase {
RangeIteratorBase() = default;
RangeIteratorBase(typename F::ParentMeshT* mesh_, size_t iStart_, size_t iEnd_);
const RangeIteratorBase& operator++();
RangeIteratorBase operator++(int);

bool operator==(const RangeIteratorBase& other) const;
bool operator!=(const RangeIteratorBase& other) const;
typename F::Etype operator*() const;
Expand Down
7 changes: 7 additions & 0 deletions include/geometrycentral/utilities/element_iterators.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ inline const RangeIteratorBase<F>& RangeIteratorBase<F>::operator++() {
return *this;
}

template <typename F>
inline RangeIteratorBase<F> RangeIteratorBase<F>::operator++(int) {
RangeIteratorBase<F> tmp = *this;
++(*this);
return tmp;
}

template <typename F>
inline bool RangeIteratorBase<F>::operator==(const RangeIteratorBase<F>& other) const {
return iCurr == other.iCurr;
Expand Down

0 comments on commit 213063f

Please sign in to comment.