Registered Member
|
Hillo there,
Just a simple example:
test turns out to be (3.f, 2.f, 1.f) always. I am using VS2013 update4 with Eigen 3.2.5. Can someone shed some light? Thanks. |
Moderator
|
Expressions templates are incompatible with the ternary operator. The problem is that the type of the ELSE expression must be the same as the type of the THEN expression. Since THEN is a Reverse<Vector3f>, the ELSE expression test0 is converted to a Reverse<Vector3f>, and therefore you're screwed A workaround in this very particular case would be to call test0.reverse().eval(), but the safest and fastest is really to avoid this ternary operator with Eigen's expressions and use a if/else construct.
|
Registered Member
|
How about type convension ?
|
Moderator
|
Nope, better use the respective ctor:
Vector3f test = 1 < 0 ? Vector3f(test0.reverse()) : test0; |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]