ANYbotics/kindr

add explicit cast function

Opened this issue · 1 comments

From Paul's email:

Hi all,
I think we shouldn't allow implicit casting in Kindr. The current implementation does things wrong (in my opinion) because:

C * C ==> C
C * C ==> C

Introducing explicit casting would deal with this in a nice way without having to solve the hard problems with lots and lots of template code. The above should generate a compiler error. We would need

C.cast() * C() ==> C

Sorry for the non-C++ pseudocode but I think you all know what I mean.

Best,

I agree on that. We could have automatic casting to the bigger types but that is probably not worth the effort and can even be confusing sometimes.