Created attachment 489 [details]
[This was posted previously at http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2014/02/msg00069.html but I never made a bug for it in bugzilla]
Another C++11 feature I'd like to see available to users is alias
templates for commonly used types.
Currently, users can create e.g. an arbitrary sized matrix of doubles
using the Eigen::MatrixXd typedef, defined in Eigen/src/Core/Matrix.h.
However, if one wants to do this with a templated type, it is necessary
to write out in full each time:
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> mat;
The attached header defines alias templates similar to MatrixXd, etc.,
which allow for the same functionality with less verbosity. With this,
the above type definition can be written as:
I've been using this now for several months and it makes my code much
clearer. Please feel free to adapt it and include it in Eigen.
Gael suggested this should go in a separate C++11 module, but it's unclear to me specifically how it should fit in the directory tree, so I attach it here as just a single file.
IIRC, the idea was to add a module <Eigen/CXX11/Core> which would include Eigen/Core and its own source files in Eigen/CXX11/src/Core/, e.g.;
We should also add a documentation page summarising C++11 features.
Summary: alias template for matrix and array classes (PR 180)
Summary: Add fully generic Vector<Type,Size> and RowVector<Type,Size> type aliases.