Use enable_if to hide methods
Submitted by Matthew Woehlke
Assigned to Nobody
Link to original bugzilla bug (#1768)
Version: 3.3 (current stable)
Description
Currently, Eigen seems to rely on static asserts to prevent calling inappropriate methods (e.g. w()
on a Matrix<T, 3, 1>
). This makes it impossible to explicitly instantiate non-Dynamic matrices, or (more interestingly) any user classes derived from the same.
These methods should instead use enable_if so that they simply don't exist if the static conditions are not satisfied. (I suppose all instances of EIGEN_STATIC_ASSERT should ideally be reviewed.)
In particular, at least the following code should compile:
#include <Eigen/Core>
template class Eigen::Matrix< int, 2, 1 >;
template class Eigen::Matrix< float, 3, 1 >;
template class Eigen::Matrix< double, 4, 1 >;