cleanup: remove copy contructors when the compiler is able to generate a satisfactory

default copy constructor; remove useless static_cast's; some misc cleanup.
This commit is contained in:
Benoit Jacob
2007-12-31 13:29:51 +00:00
parent 86220784b6
commit 42f6590bb2
21 changed files with 53 additions and 81 deletions

View File

@@ -32,14 +32,7 @@ template<typename MatrixType> class Map
public:
typedef typename MatrixType::Scalar Scalar;
friend class MatrixBase<Scalar, Map<MatrixType> >;
Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols)
{
assert(rows > 0 && cols > 0);
}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -65,6 +58,17 @@ template<typename MatrixType> class Map
else // RowDominant
return const_cast<Scalar*>(m_data)[col + row * m_cols];
}
public:
Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols)
{
assert(rows > 0
&& (_RowsAtCompileTime == Dynamic || _RowsAtCompileTime == rows)
&& cols > 0
&& (_ColsAtCompileTime == Dynamic || _ColsAtCompileTime == cols));
}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
protected:
const Scalar* m_data;