inline g_cFloat g_cFloat::m_ffXOr(g_cFloat p_fFloat)
return g_cFloat(m_fFloat ^ p_fFloat);
inline g_cFloat g_cFloat::m_ffXOr(g_cFloat p_fFloat) const
return g_gFloat(m_fFloat ^ p_fFloat);
I was making a modified class for floating point numbers when I suddenly saw there was a need for logic operations such as and, or not and xor, when I got to the xor function. I had made all functions that didn't modify any data in the class constant, but when I tried to perform and xor the constant data it didn't work. why?
Thanks in advance.
Assuming that m_fFloat is a member variable of your 'g_cFloat' class then:
m_fFloat ^ p_fFloat will store the result of the operation in the m_fFloat variable; this is maybe causing the problem.
Probably what so is the case, although I how should I do it then?
(I've always been under the impression that a=b^c stored a value in a, and a^=b does what you're saying this does)
and do I do what I wanted to do then?
Bitwise operators only work with intergral types.
Although, I guess I'll have to remove those functions now.
You could write your own operator^, but without casting/converting to integers you won't be able to use the built in bitwise operator ^.