Registered Member
|
Hi all
I have a problem when using Vector3d as parameters. I recently upgraded to Update 2 of VS2013, an now the following code doens't compile anymore. What's wrong with it? I have something like this:
and call it like that:
Until now it worked, but Update 2 gives me the following error: error C2664: 'int HapticDevices::GenericHapticDevice::getPosition(Eigen::Ref<Eigen::VectorXd,0,Eigen::InnerStride<1>>,int)' : cannot convert argument 1 from 'Eigen::Vector3d' to 'Eigen::Ref<Eigen::VectorXd,0,Eigen::InnerStride<1>>' It looks like I have to change pos somehow, but I don't now how. Can someone please help me? It is surely a small thing, but I don't get it... Thanks, Bob |
Moderator
|
hm, it seems that they introduced some regression. Works for me with clang, gcc, and icc:
In doubt, make sure you have the latest version of Eigen. |
Moderator
|
hm, the compilation error is talking about a "Ref<VectorXd...>" while your code is showing a "Ref<Vector3d...>".
|
Registered Member
|
Hi, thanks for the answer, the VectorXd is from another try, but didn't help. It should be Vector3d.
I just copy pasted your code, gives me the exact same error (just to be sure), and I'm using the latest Eigen, 3.2.1. What about using just something like
What's the disadvantage of this? |
Moderator
|
For small vectors like this, there is no disadvantage. Ref<> is useful to pass sub-vectors or sub-matrices to functions without copies while avoiding the need for templates.
|
Registered Member
|
Ok, because when not using Refs, it compiles. So could this be a problem with Eigen or the VC compiler? Should I open a bug report?
|
Moderator
|
There is an implicit constructor of Ref<> from a DenseBase object, and Vector3f inherits DenseBase, so I think this is a VC issue.
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]