diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-10-31 11:50:15 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-10-31 11:50:15 -0400 |
commit | 48261fc77381bb65401b1af3e41bae387fbbfce1 (patch) | |
tree | adf58f6c3b4227030881a60129bf61b4dfd37cea /Eigen | |
parent | ec70f8006be1e46055a0d65850c8c60c3bebf6ed (diff) |
* default MatrixBase ctor: make it protected, make it a static assert, only do the check when debugging eigen to avoid slowing down compilation for everybody (this check is paranoiac, it's very seldom useful)
* add private MatrixBase ctors to catch cases when the user tries to construct MatrixBase objects directly
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 24 | ||||
-rw-r--r-- | Eigen/src/Core/util/StaticAssert.h | 1 | ||||
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 2 |
3 files changed, 20 insertions, 7 deletions
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index cb1589f85..72ce865c1 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -145,12 +145,6 @@ template<typename Derived> class MatrixBase #endif }; - /** Default constructor. Just checks at compile-time for self-consistency of the flags. */ - MatrixBase() - { - ei_assert(ei_are_flags_consistent<Flags>::ret); - } - #ifndef EIGEN_PARSED_BY_DOXYGEN /** This is the "real scalar" type; if the \a Scalar type is already real numbers * (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If @@ -802,6 +796,24 @@ template<typename Derived> class MatrixBase #ifdef EIGEN_MATRIXBASE_PLUGIN #include EIGEN_MATRIXBASE_PLUGIN #endif + + protected: + /** Default constructor. Do nothing. */ + MatrixBase() + { + /* Just checks for self-consistency of the flags. + * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down + */ +#ifdef EIGEN_INTERNAL_DEBUGGING + EIGEN_STATIC_ASSERT(ei_are_flags_consistent<Flags>::ret, + INVALID_MATRIXBASE_TEMPLATE_PARAMETERS) +#endif + } + + private: + explicit MatrixBase(int); + MatrixBase(int,int); + template<typename OtherDerived> explicit MatrixBase(const MatrixBase<OtherDerived>&); }; #endif // EIGEN_MATRIXBASE_H diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h index 6210bc91c..56a57b706 100644 --- a/Eigen/src/Core/util/StaticAssert.h +++ b/Eigen/src/Core/util/StaticAssert.h @@ -76,6 +76,7 @@ THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES, THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES, INVALID_MATRIX_TEMPLATE_PARAMETERS, + INVALID_MATRIXBASE_TEMPLATE_PARAMETERS, BOTH_MATRICES_MUST_HAVE_THE_SAME_STORAGE_ORDER, THIS_METHOD_IS_ONLY_FOR_DIAGONAL_MATRIX, THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE, diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index cea2faaa8..be4266f85 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -1,4 +1,4 @@ -// This file is part of Eigen, a lightweight C++ template library +// // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> |