mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-02 00:34:14 +08:00
Add operators to CompressedStorageIterator
This commit is contained in:
parent
e1aee4ab39
commit
4bb2446796
@ -411,16 +411,18 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool operator==(const CompressedStorageIterator& other) const { return m_index == other.m_index; }
|
||||
inline bool operator!=(const CompressedStorageIterator& other) const { return m_index != other.m_index; }
|
||||
inline bool operator< (const CompressedStorageIterator& other) const { return m_index < other.m_index; }
|
||||
inline CompressedStorageIterator operator+(difference_type offset) const { return CompressedStorageIterator(m_index + offset, m_data); }
|
||||
inline CompressedStorageIterator operator-(difference_type offset) const { return CompressedStorageIterator(m_index - offset, m_data); }
|
||||
inline difference_type operator-(const CompressedStorageIterator& other) const { return m_index - other.m_index; }
|
||||
inline CompressedStorageIterator& operator++() { ++m_index; return *this; }
|
||||
inline CompressedStorageIterator& operator--() { --m_index; return *this; }
|
||||
inline CompressedStorageIterator& operator+=(difference_type offset) { m_index += offset; return *this; }
|
||||
inline CompressedStorageIterator& operator-=(difference_type offset) { m_index -= offset; return *this; }
|
||||
inline reference operator*() const { return reference(m_data.m_innerIndexIterator + m_index, m_data.m_valueIterator + m_index); }
|
||||
|
||||
#define MAKE_COMP(OP) inline bool operator OP(const CompressedStorageIterator& other) const { return m_index OP other.m_index; }
|
||||
MAKE_COMP(<) MAKE_COMP(>) MAKE_COMP(>=) MAKE_COMP(<=) MAKE_COMP(!=) MAKE_COMP(==)
|
||||
|
||||
protected:
|
||||
difference_type m_index;
|
||||
reference m_data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user