Created attachment 489 [details] eigen3-typedefs.hpp [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: Eigen::MatrixX<T> mat; 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.; Eigen/CXX11/src/Core/Typedefs.h We should also add a documentation page summarising C++11 features.
At last: https://bitbucket.org/eigen/eigen/commits/39fed2ad6650/ Summary: alias template for matrix and array classes (PR 180) https://bitbucket.org/eigen/eigen/commits/fed0f93f7118/ Summary: Add fully generic Vector<Type,Size> and RowVector<Type,Size> type aliases.
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/864.