Overloadable operators — you gotta love ’em! They allow you to give your types the same syntax as C++’s built-in types, yet they let you put a measure of power into the functions behind the operators that’s unheard of for the built-ins. Of course, the fact that you can make symbols like “
+” and “
==” do anything you want also means you can use overloaded operators to produce programs best described as impenetrable. Adept C++ programmers know how to harness the power of operator overloading without descending into the incomprehensible.
Regrettably, it is easy to make the descent. Single-argument constructors and implicit type conversion operators are particularly troublesome, because they can be invoked without there being any ...