aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Block.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-01-07 05:16:01 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-01-07 05:16:01 -0500
commit98f027430565fab169bee441e8c5db64b53709c7 (patch)
treecfcc13910f07439f9b5ccf83f83332686b06730a /Eigen/src/Core/Block.h
parentc7baf07a3e687784d7fcf7f00475f69f62c510e3 (diff)
third pass of const-correctness fixes (bug #54), hopefully the last one...
Diffstat (limited to 'Eigen/src/Core/Block.h')
-rw-r--r--Eigen/src/Core/Block.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index de384b025..99e0cdc1f 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -119,7 +119,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
/** Column or Row constructor
*/
- inline Block(const XprType& xpr, Index i)
+ inline Block(typename internal::as_argument<XprType>::type xpr, Index i)
: m_xpr(xpr),
// It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime,
// and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1,
@@ -137,7 +137,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
/** Fixed-size constructor
*/
- inline Block(const XprType& xpr, Index startRow, Index startCol)
+ inline Block(typename internal::as_argument<XprType>::type xpr, Index startRow, Index startCol)
: m_xpr(xpr), m_startRow(startRow), m_startCol(startCol),
m_blockRows(BlockRows), m_blockCols(BlockCols)
{
@@ -148,7 +148,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
/** Dynamic-size constructor
*/
- inline Block(const XprType& xpr,
+ inline Block(typename internal::as_argument<XprType>::type xpr,
Index startRow, Index startCol,
Index blockRows, Index blockCols)
: m_xpr(xpr), m_startRow(startRow), m_startCol(startCol),
@@ -265,10 +265,10 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
/** Column or Row constructor
*/
- inline Block(XprType& xpr, Index i)
- : Base(&xpr.coeffRef(
+ inline Block(typename internal::as_argument<XprType>::type xpr, Index i)
+ : Base(internal::const_cast_ptr(&xpr.coeffRef(
(BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0,
- (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0),
+ (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0)),
BlockRows==1 ? 1 : xpr.rows(),
BlockCols==1 ? 1 : xpr.cols()),
m_xpr(xpr)
@@ -281,8 +281,8 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
/** Fixed-size constructor
*/
- inline Block(XprType& xpr, Index startRow, Index startCol)
- : Base(&xpr.coeffRef(startRow,startCol)), m_xpr(xpr)
+ inline Block(typename internal::as_argument<XprType>::type xpr, Index startRow, Index startCol)
+ : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol))), m_xpr(xpr)
{
eigen_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= xpr.rows()
&& startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= xpr.cols());
@@ -291,10 +291,10 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
/** Dynamic-size constructor
*/
- inline Block(XprType& xpr,
+ inline Block(typename internal::as_argument<XprType>::type xpr,
Index startRow, Index startCol,
Index blockRows, Index blockCols)
- : Base(&xpr.coeffRef(startRow,startCol), blockRows, blockCols),
+ : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol)), blockRows, blockCols),
m_xpr(xpr)
{
eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows)
@@ -326,7 +326,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
#ifndef EIGEN_PARSED_BY_DOXYGEN
/** \internal used by allowAligned() */
- inline Block(const XprType& xpr, const Scalar* data, Index blockRows, Index blockCols)
+ inline Block(typename internal::as_argument<XprType>::type xpr, const Scalar* data, Index blockRows, Index blockCols)
: Base(data, blockRows, blockCols), m_xpr(xpr)
{
init();