There has been much discussion over the years about the usefulness of operator overloading in C++ as well as the ability to get it right.
In reality, it's hard to get it wrong as long as you follow the canonical forms of the operators and don't do unexpected things like overloade the + operator to perform a subtraction operation. Also, the types that your overloaded operators work with should be consistent.
Short answer: don't do it!
Long answer:
As the C++ example from the article on Real World Haskell Chapter 1-2 showed:
#include <iostream> bool getbool(bool b) { std::cout << " getbool called " << std::endl;
Recent comments
2 days 11 hours ago
2 days 11 hours ago
3 days 7 hours ago
1 week 1 day ago
1 week 1 day ago
2 weeks 22 hours ago
9 weeks 3 days ago
13 weeks 4 days ago
16 weeks 2 days ago
16 weeks 4 days ago