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<
, operator<=
, operator>
, and 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, ...
Get Beyond the C++ Standard Library: An Introduction to Boost now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.