diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-02-01 15:04:33 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-02-01 15:04:33 +0100 |
commit | ec469700dcf82fd9b5668fe3c82d9dac49d147df (patch) | |
tree | 84cdee05c58b8ed5a35f18278422e830f88c7156 /Eigen/src | |
parent | 6e0a86194ce6664e83d8035cbdd6047e5a27ed43 (diff) |
bug #557: make InnerIterator of sparse storage types more versatile by adding default-ctor, copy-ctor/assignment
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/SparseCore/SparseCompressedBase.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Eigen/src/SparseCore/SparseCompressedBase.h b/Eigen/src/SparseCore/SparseCompressedBase.h index f78d7c24d..ea71b41d1 100644 --- a/Eigen/src/SparseCore/SparseCompressedBase.h +++ b/Eigen/src/SparseCore/SparseCompressedBase.h @@ -117,6 +117,24 @@ template<typename Derived> class SparseCompressedBase<Derived>::InnerIterator { public: + InnerIterator() + : m_values(0), m_indices(0), m_outer(0), m_id(0), m_end(0) + {} + + InnerIterator(const InnerIterator& other) + : m_values(other.m_values), m_indices(other.m_indices), m_outer(other.m_outer), m_id(other.m_id), m_end(other.m_end) + {} + + InnerIterator& operator=(const InnerIterator& other) + { + m_values = other.m_values; + m_indices = other.m_indices; + const_cast<OuterType&>(m_outer).setValue(other.m_outer.value()); + m_id = other.m_id; + m_end = other.m_end; + return *this; + } + InnerIterator(const SparseCompressedBase& mat, Index outer) : m_values(mat.valuePtr()), m_indices(mat.innerIndexPtr()), m_outer(outer) { @@ -162,7 +180,8 @@ class SparseCompressedBase<Derived>::InnerIterator protected: const Scalar* m_values; const StorageIndex* m_indices; - const internal::variable_if_dynamic<Index,Derived::IsVectorAtCompileTime?0:Dynamic> m_outer; + typedef internal::variable_if_dynamic<Index,Derived::IsVectorAtCompileTime?0:Dynamic> OuterType; + const OuterType m_outer; Index m_id; Index m_end; private: |