This bugzilla service is closed. All entries have been migrated to

Bug 864

Summary: C++11 alias templates for commonly used types
Product: Eigen Reporter: Jim Garrison <jim>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Severity: Unknown CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal Keywords: JuniorJob
Version: unspecified   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 814    
Description Flags
eigen3-typedefs.hpp none

Description Jim Garrison 2014-08-26 06:36:33 UTC
Created attachment 489 [details]

[This was posted previously at 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.
Comment 1 Gael Guennebaud 2014-08-26 10:31:25 UTC
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.
Comment 2 Gael Guennebaud 2019-02-20 14:25:39 UTC
At last:
Summary:     alias template for matrix and array classes (PR 180)
Summary:     Add fully generic Vector<Type,Size> and RowVector<Type,Size> type aliases.
Comment 3 Nobody 2019-12-04 13:38:28 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to'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: