mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Clarify error message when writing to a read-only sparse-sub-matrix.
This commit is contained in:
parent
040cf33e8f
commit
eb6d9aea0e
@ -73,8 +73,15 @@ public:
|
|||||||
Index m_outerStart;
|
Index m_outerStart;
|
||||||
const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
|
const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
|
// Disable assignment with clear error message.
|
||||||
|
// Note that simply removing operator= yields compilation errors with ICC+MSVC
|
||||||
|
template<typename T>
|
||||||
|
BlockImpl& operator=(const T&)
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(sizeof(T)==0, THIS_SPARSE_BLOCK_SUBEXPRESSION_IS_READ_ONLY);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -425,14 +432,22 @@ public:
|
|||||||
|
|
||||||
Index nonZeros() const { return Dynamic; }
|
Index nonZeros() const { return Dynamic; }
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
|
|
||||||
|
|
||||||
typename internal::ref_selector<XprType>::non_const_type m_matrix;
|
typename internal::ref_selector<XprType>::non_const_type m_matrix;
|
||||||
const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
|
const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
|
||||||
const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
|
const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
|
||||||
const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
|
const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
|
||||||
const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
|
const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Disable assignment with clear error message.
|
||||||
|
// Note that simply removing operator= yields compilation errors with ICC+MSVC
|
||||||
|
template<typename T>
|
||||||
|
BlockImpl& operator=(const T&)
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(sizeof(T)==0, THIS_SPARSE_BLOCK_SUBEXPRESSION_IS_READ_ONLY);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user