ousnius / nifly

C++ NIF library for the Gamebryo/NetImmerse File Format
GNU General Public License v3.0
54 stars 21 forks source link

fix: compile issues with compiler cannot detect difference between th… #39

Closed MrTroble closed 1 year ago

MrTroble commented 1 year ago

…e symetrical functions

Equality oprations should be symetrical hence

x == y <=> y == x

therefore both inputs need the same type and therefore need to be const

MrTroble commented 1 year ago

This should fix the following compilation error in MSVC 19.36.32532

While this might also be a compiler bug I am not sure it still would be good to have the comparisions const.

error C2666: 'nifly::Matrix3::operator ==': overloaded functions have similar conversions
  note: could be 'bool nifly::Matrix3::operator ==(const nifly::Matrix3 &)'
  note: or 'bool nifly::Matrix3::operator ==(const nifly::Matrix3 &)' [synthesized expression 'y == x']
  note: while trying to match the argument list '(nifly::Matrix3, nifly::Matrix3)'
ousnius commented 1 year ago

I don't get any compiler error/warning from this and neither does cmake https://github.com/ousnius/nifly/actions/workflows/cmake.yml Gonna merge though, thanks.