From 01572b9f54e769a7d1bb3d5073c264a5fbc7ce42 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 10 Mar 2008 17:23:11 +0000 Subject: big change: MatrixBase only takes one template parameter "Derived", the template parameter "Scalar" is removed. This is achieved by introducting a template struct Scalar to achieve a forward-declaration of the Scalar typedefs. --- Eigen/src/Core/Random.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'Eigen/src/Core/Random.h') diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h index 394e6c3b0..364b8f4ed 100644 --- a/Eigen/src/Core/Random.h +++ b/Eigen/src/Core/Random.h @@ -32,14 +32,18 @@ * \sa MatrixBase::random(), MatrixBase::random(int), MatrixBase::random(int,int), * MatrixBase::setRandom() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Random : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; private: enum { @@ -86,9 +90,9 @@ template class Random : NoOperatorEquals, * * \sa ei_random(), ei_random(int) */ -template +template const Eval > -MatrixBase::random(int rows, int cols) +MatrixBase::random(int rows, int cols) { return Random(rows, cols).eval(); } @@ -109,9 +113,9 @@ MatrixBase::random(int rows, int cols) * * \sa ei_random(), ei_random(int,int) */ -template +template const Eval > -MatrixBase::random(int size) +MatrixBase::random(int size) { assert(Traits::IsVectorAtCompileTime); if(Traits::RowsAtCompileTime == 1) return Random(1, size).eval(); @@ -129,9 +133,9 @@ MatrixBase::random(int size) * * \sa ei_random(int), ei_random(int,int) */ -template +template const Eval > -MatrixBase::random() +MatrixBase::random() { return Random(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime).eval(); } @@ -143,8 +147,8 @@ MatrixBase::random() * * \sa class Random, ei_random() */ -template -Derived& MatrixBase::setRandom() +template +Derived& MatrixBase::setRandom() { return *this = Random(rows(), cols()); } -- cgit v1.2.3