Node:Arithmetic operations, Next:Comparisons, Previous:Base, Up:Function objects
| plus |
Function Object |
| minus |
Function Object |
| times |
Function Object |
| divides |
Function Object |
| modulus |
Function Object |
| negate |
Function Object |
|
The library provides basic function object classes for all of the arithmetic operators in the language. |
templatestruct plus : binary_function { T operator()(const T& x, const T& y) const { return x + y; } }; template struct minus : binary_function { T operator()(const T& x, const T& y) const { return x - y; } }; template struct times : binary_function { T operator()(const T& x, const T& y) const { return x * y; } }; template struct divides : binary_function { T operator()(const T& x, const T& y) const { return x / y; } }; template struct modulus : binary_function { T operator()(const T& x, const T& y) const { return x % y; } }; template struct negate : unary_function { T operator()(const T& x) const { return -x; } };