aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Map.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-03-12 17:17:36 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-03-12 17:17:36 +0000
commit2ee68a074efc1163358fb3b51fb4b23e83a05f97 (patch)
tree48df581770a55f8eb9f632aee54c777816478b64 /Eigen/src/Core/Map.h
parent01572b9f54e769a7d1bb3d5073c264a5fbc7ce42 (diff)
generalized ei_traits<>.
Finally the importing macro is named EIGEN_BASIC_PUBLIC_INTERFACE because it does not only import the ei_traits, it also makes the base class a friend, etc.
Diffstat (limited to 'Eigen/src/Core/Map.h')
-rw-r--r--Eigen/src/Core/Map.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index 634a17165..e1b71952a 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -39,26 +39,25 @@
* \sa Matrix::map()
*/
template<typename MatrixType>
-struct Scalar<Map<MatrixType> >
-{ typedef typename Scalar<MatrixType>::Type Type; };
+struct ei_traits<Map<MatrixType> >
+{
+ typedef typename MatrixType::Scalar Scalar;
+ enum {
+ RowsAtCompileTime = MatrixType::RowsAtCompileTime,
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime,
+ MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
+ };
+};
template<typename MatrixType> class Map
: public MatrixBase<Map<MatrixType> >
{
public:
- typedef typename Scalar<MatrixType>::Type Scalar;
- friend class MatrixBase<Map>;
- friend class MatrixBase<Map>::Traits;
- typedef MatrixBase<Map> Base;
+
+ EIGEN_BASIC_PUBLIC_INTERFACE(Map)
private:
- enum {
- RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime,
- ColsAtCompileTime = MatrixType::Traits::ColsAtCompileTime,
- Order = MatrixType::StorageOrder,
- MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime,
- MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime
- };
const Map& _asArg() const { return *this; }
int _rows() const { return m_rows; }
@@ -66,7 +65,7 @@ template<typename MatrixType> class Map
const Scalar& _coeff(int row, int col) const
{
- if(Order == ColumnMajor)
+ if(MatrixType::StorageOrder == ColumnMajor)
return m_data[row + col * m_rows];
else // RowMajor
return m_data[col + row * m_cols];
@@ -74,7 +73,7 @@ template<typename MatrixType> class Map
Scalar& _coeffRef(int row, int col)
{
- if(Order == ColumnMajor)
+ if(MatrixType::StorageOrder == ColumnMajor)
return const_cast<Scalar*>(m_data)[row + col * m_rows];
else // RowMajor
return const_cast<Scalar*>(m_data)[col + row * m_cols];