How to create a operator in C++
I getting really frustrated on the fact that the POINT structure dosn´t have a == operator!
That''s why I want to learn how to create my own operators...
Please show me some code.
Zeblar Nagrim, Lord of Chaos
|
Just because the church was wrong doesn''t mean Galileo wasn''t a heritic.
It just means he was a heritic who was right.
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
A possibly slightly faster version of the above code would be (uses short circuit evaluation):
Dire Wolf
www.digitalfiends.com
Edited by - Dire.Wolf on March 6, 2001 1:50:31 AM
|
Dire Wolf
www.digitalfiends.com
Edited by - Dire.Wolf on March 6, 2001 1:50:31 AM
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
It doesn''t have a == operator or any other operators for that matter is so that it can be used in C as well. If you want operator overloading, you could do it yourself, or use MFC''s CPoint
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Thank you Atavist for the explanation and Dire.Wolf for the optimization. Thank you guys!
Greetings,
Zeblar Nagrim, Lord of Chaos
Greetings,
Zeblar Nagrim, Lord of Chaos
Heh, my fault. It would have evaluated to the same optimization either way
Dire Wolf
www.digitalfiends.com
Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement