Added += and + operators to inner iterators

Fix #1340
#1340
This commit is contained in:
Valentin Roussellet
2016-12-28 18:29:30 +01:00
parent 5c27962453
commit d3c5525c23
2 changed files with 21 additions and 0 deletions

View File

@@ -185,6 +185,14 @@ class SparseCompressedBase<Derived>::InnerIterator
}
inline InnerIterator& operator++() { m_id++; return *this; }
inline InnerIterator& operator+=(Index i) { m_id += i ; return *this; }
inline InnerIterator operator+(Index i)
{
InnerIterator result = *this;
result += i;
return result;
}
inline const Scalar& value() const { return m_values[m_id]; }
inline Scalar& valueRef() { return const_cast<Scalar&>(m_values[m_id]); }
@@ -245,6 +253,14 @@ class SparseCompressedBase<Derived>::ReverseInnerIterator
}
inline ReverseInnerIterator& operator--() { --m_id; return *this; }
inline ReverseInnerIterator& operator-=(Index i) { m_id -= i; return *this; }
inline ReverseInnerIterator operator-(Index i)
{
ReverseInnerIterator result = *this;
result -= i;
return result;
}
inline const Scalar& value() const { return m_values[m_id-1]; }
inline Scalar& valueRef() { return const_cast<Scalar&>(m_values[m_id-1]); }