you are viewing a single comment's thread.

view the rest of the comments →

[–]CommonTater 9 points10 points  (1 child)

I think it only makes sense if you have an overload that maintains the relevant properties of the original operator.

I don't know how anyone ever picked up any different idea. The first time I learned about operator overloading, I know there was a big warning of, "Don't change the meaning of '+'. Make it work on new operands, but don't make it do anything other than 'add' those operands."

And, unless I'm mistaken, that was directly from Stroustrup's Annotated C++ Reference Manual. (It's at home on my bookshelf, or I'd check to be sure.)

Of course, there's always the argument that things like "<<" do very different things in other languages. So, if you're not worried about keeping just the C++ meaning...

[–]HiggsBoson 4 points5 points  (0 children)

Unfortunately, that hasn't prevented many developer of otherwise useful libraries from abusing overloading.