Attempting to make a class that takes both a Eigen::Matrix3d
and Eigen::Vector4d
as constructor args and have run into an issue with ambiguity. Given the following test class,
class MyClass
{
public:
MyClass(const Eigen::Matrix3d& m)
{
}
MyClass(const Eigen::Vector4d& v)
{
}
};
If I then do the following,
int main(int argc, char** argv)
{
Matrix3d m;
MyClass t1(m.transpose());
}
this fails to compile with the following error,
call of overloaded ‘MyClass(Eigen::Transpose<Eigen::Matrix<double, 3, 3> >)’ is ambiguous
516 | MyClass t1(m.transpose());
| ^
note: candidate: ‘MyClass::MyClass(const Vector4d&)’
561 | MyClass(const Eigen::Vector4d& v)
| ^~~~~~~
note: candidate: ‘MyClass::MyClass(const Matrix3d&)’
556 | MyClass(const Eigen::Matrix3d& m)
It's not clear to me how to resolve this issue