Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

(2^19)+6th reason why C++ sucks

Name: RAGE 2012-02-05 11:18

error: overloaded 'operator=' must be a non-static member function

This bitch does not allow me to implement custom operator= for class that I can't modify(well, I can apt-get source or modify header files but it's too dirty).

I can overload += as static non-member function just fine.

So in other words, if I need to use Library1 that provides Vector3 and Library2 that provides VecXYZ and these libraries do not know about existence of each other I can write additional functions so vector3+vecXYZ,vector3+=vecXYZ will work but assignment is no-no. Thou shalt not write functions for converting one type of vectors to another.

WTF? Where is justice?

Name: Anonymous 2012-02-07 13:22

I can't believe the retardation of OP. Consider a situation where you'd be using both vector types. Now imagine how INCREDIBLY FUCKING CONFUSING it would be for anyone else (and YOU) reading your program, to see a vector that is obviously of type VecXYZ, being assigned the value of a Vector3.

operator= in C++ is for assigning values, not for implicit typecasting. It's people like you have given operator overloading the bad rap it has. If you want to convert VecXYZ to Vector3, write a vecXyzToVector3() function.

Seriously, fuck.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List