Library 4. Operators
How Does the Operators Library Improve Your Programs?
• Provides a complete set of comparison operators
• Provides a complete set of arithmetic operators
• Provides a complete set of operators for iterators
Among the operators defined in C++, there are a number of related sets. When you encounter a class with one operator from one of these sets, you typically expect to find the others, too. For instance, when a class provides
operator==, you expect to find
operator!= and probably
operator>=. Sometimes, a class only provides
operator< in order to define an ordering so objects of that class can be used in associative containers, but that often leaves class users wanting more. Likewise, ...