[eigen] patch with compile for for MSVC 2010

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


the two attached patches are two alternative ways to fix compilation with MSVC 2010.

The basic problem is that SFINAE didn't kick in soon enough to prevent wrong overload resolution on MSVC 2010. The compiler deduced the return type Eigen::CwiseBinaryOp and determined that it didn't contain the required method, without realizing that if he had worked out the template arguments given to Eigen::CwiseBinaryOp, he would have run into a substitution failure, such that the overload wouldn't exist in the first place.

The short and simple fix is to wrap the return type in a "typename internal::enable_if<true,
complicated_return_type >::type", because this seems sufficient that MSVC 2010 tries to work out the full type, and realize the substitution failure.

The more verbose (and less "not sure why this works while that fails") fix is to have a "enum { Defined = 1 };" in addition to the computed type, and use "internal::enable_if" on this "Defined", like done in some other places.


P.S:: The error message just says

..\eigen-3.3\unsupported\eigen\src/Splines/Spline.h(307): error C2039: 'rowwise' : is not a member of 'Eigen::CwiseBinaryOp'
..\eigen-3.3\eigen\src/Core/CwiseBinaryOp.h(77) : see declaration of 'Eigen::CwiseBinaryOp'

and the corresponding line looks as follows:

    return (ctrl_weights * ctrl_pts).rowwise().sum();

The reason for the error is that operator* used the wrong (scalar * matrix) overload, instead of the correct (matrix * matrix) overload.

Attachment: compile-fix-MSVC-2010.patch
Description: Binary data

Attachment: short-compile-fix-MSVC-2010.patch
Description: Binary data

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/