diff --git a/Eigen/src/Core/Reshape.h b/Eigen/src/Core/Reshape.h index 9d1a6765d..896392798 100644 --- a/Eigen/src/Core/Reshape.h +++ b/Eigen/src/Core/Reshape.h @@ -207,32 +207,34 @@ template index_remap(Index rowId, Index colId) const { + typedef std::pair RowCol; + + inline RowCol index_remap(Index rowId, Index colId) const { const Index nth_elem_idx = colId * m_reshapeRows.value() + rowId; const Index actual_col = nth_elem_idx / m_xpr.rows(); const Index actual_row = nth_elem_idx % m_xpr.rows(); - return {actual_row, actual_col}; + return RowCol(actual_row, actual_col); } EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index rowId, Index colId) { EIGEN_STATIC_ASSERT_LVALUE(XprType) - const auto row_col = index_remap(rowId, colId); + const RowCol row_col = index_remap(rowId, colId); return m_xpr.const_cast_derived().coeffRef(row_col.first, row_col.second); } EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { - const auto row_col = index_remap(rowId, colId); + const RowCol row_col = index_remap(rowId, colId); return m_xpr.derived().coeffRef(row_col.first, row_col.second); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const { - const auto row_col = index_remap(rowId, colId); + const RowCol row_col = index_remap(rowId, colId); return m_xpr.coeff(row_col.first, row_col.second); } @@ -240,7 +242,7 @@ template inline PacketScalar packet(Index rowId, Index colId) const { - const auto row_col = index_remap(rowId, colId); + const RowCol row_col = index_remap(rowId, colId); return m_xpr.template packet(row_col.first, row_col.second); } @@ -274,7 +276,7 @@ template inline void writePacket(Index rowId, Index colId, const PacketScalar& val) { - const auto row_col = index_remap(rowId, colId); + const RowCol row_col = index_remap(rowId, colId); m_xpr.const_cast_derived().template writePacket (row_col.first, row_col.second, val); } @@ -282,7 +284,7 @@ template inline PacketScalar packet(Index index) const { - const auto row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); return m_xpr.template packet(row_col.first, row_col.second); } @@ -290,7 +292,7 @@ template inline void writePacket(Index index, const PacketScalar& val) { - const auto row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); return m_xpr.template packet(row_col.first, row_col.second, val); } @@ -317,7 +319,7 @@ template -//class ReshapeImpl_dense +//class ReshapeImpl_dense // : public MapBase > //{ // typedef Reshape ReshapeType;