kindr icon indicating copy to clipboard operation
kindr copied to clipboard

add explicit cast function

Open HannesSommer opened this issue 10 years ago • 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,

HannesSommer avatar Aug 12 '14 09:08 HannesSommer

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.

HannesSommer avatar Aug 12 '14 09:08 HannesSommer