Although operator overloading plays a crucial role in many C++ programming techniques and idioms. Without operator overloading, generic programming would be difficult if not impossible in C++.
This is the first of two sessions explaining how to overload operators properly. It focuses on defining operators that mimic the behaviors of built-in operators so that user-defined types can work as effectively as built-in types when used with generic algorithms. It explains subtleties such as when to pass parameters and return results by value, by reference (lvalue or rvalue) or by reference-to-const, and when to define operators as members or as non-members. It also explains how to write operators that are as efficient as they can be, and harder to misuse.