Skip to content

(Optionally) prohibit to assign row expressions to column vectors (and vice versa)

Submitted by Antonio Cervone

Assigned to Nobody

Link to original bugzilla bug (#1218)
Version: 3.4 (development)

Description

I discovered that the row() method return type can be implicitly converted to a column vector, as in this example

#include <iostream>

#include <Eigen/Dense>

int main()

{

Eigen::Matrix<double,2,2> A;

A << 1, 2, 3, 4;

auto Arow = A.row(0);

std::cout << Arow << std::endl;

Eigen::Matrix<double,2,1> Acol = A.row(1);

std::cout << Acol << std::endl;

return 0;

}

I think that the second operation should give an error, and explicitly require a call to transpose() to work in this way.

Why is this happening? Is there any design here that I am not aware of?

Blocking

#331 #814