Quote:Original post by Sharlin
Well, using operator| to scale a vector isn't too obvious either.
yeah i suppose i missed that. i was only looking at the code inside the function.
yeah, thats bad alright...
Quote:Original post by Sharlin
Well, using operator| to scale a vector isn't too obvious either.
Quote:Original post by Sharlin
Woah, that's one hell of a WTF. Code like that is why some (mostly Java) people insist that operator overloading is an unconditionally bad feature.
Quote:Original post by socrates200X
...Does this even compile?
CVector a( 1, 1, 1 ); CVector b( 2, 2, 2 ); CVector c = a + b|3;
If you think it is [7, 7, 7], you are the victim of poorly designed operator overloading.
Quote:Original post by JohnBoltonQuote:Original post by socrates200X
...Does this even compile?
It's probably a typo -- otherwise it won't compile for a couple reasons. As you note, it should be"CVector::operator |"
Quote:Original post by JohnBoltonQuote:Original post by socrates200X
...Does this even compile?
It's probably a typo or defined inside the class -- otherwise it won't compile for a couple reasons. As you note, it should then be "CVector::operator |"
BTW, one reason for not using '|' for multiplication is that the precedence is wrong. What is the value of c below?If you think it is [7, 7, 7], you are the victim of poorly designed operator overloading.CVector a( 1, 1, 1 ); CVector b( 2, 2, 2 ); CVector c = a + b|3;
Quote:Original post by SamLowry
The future lies in whitespace overloading.