Skip to content

Patch for making CommaInitializer a true expression template

Submitted by ric..@..il.com

Assigned to Nobody

Link to original bugzilla bug (#716)
Version: 3.2

Description

Created attachment 406

Makes CommaInitializer a true expression template

Please also see http://forum.kde.org/viewtopic.php?f=74&t=117882 for the forum discussion on this.

With the help of Gael I prepared a patch that makes CommaInitializer a true expression template. This permits syntax such as:

typedef Eigen::VectorXd Vector;

Vector vector = (Vector(3) << 1, 2, 3); // Initialization from a temporary

functionCall(a, b, (Vector() << 1, 2, 3)); // Passing into a function

without the use of .finished(). This is nice because when doing a lot of inline vector/matrix creation, using .finished() is tedious.

I'm not very experienced at modifying Eigen's internal code, so this patch should be checked by someone more experienced. I verified this works using project code using Eigen on MSVC 11.0 and gcc 4.7.3.

Also, what documentation and unit tests need to be modified to account for this change?

Patch 406, "Makes CommaInitializer a true expression template":

CommaInitializer.patch

Blocking

#1608