qualify non-const symbolic indexed view with is_lvalue

Reference issue

What does this implement/fix?

Isn't it patently obvious from the title?

In some situations, the compiler will use the non-const symbolic indexed view overload when the expression is not an l-value. This adds an explicit qualifier to check for l-value-ness during template substitution.

 Eigen::VectorXd vec(10);
 auto mapExpr = Eigen::Map<const Eigen::VectorXd>(vec.data(), vec.size()); // oops, the type should be const Map<const VectorXd>!
 const Eigen::Index start_idx = mapExpr(0) < mapExpr(Eigen::indexing::last) ? 0 : mapExpr.size() - 1;

Additional information

Edited by Charles Schlosser

Merge request reports

Loading