Руководство по стандартной библиотеке шаблонов STL

       

Арифметические операции (Arithmetic operations)


Библиотека обеспечивает базовые классы функциональных объектов для всех арифметических операторов языка.

template struct plus : binary_function { Т operator()(const T& x, const T& y) const { return x + y; } }; template struct minus : binary_function { Т operator()(const T& x, const T& y) const { return x - y; } }; template struct times : binary_function { Т operator()(const T& x, const T& y) const ( return x * y; } }; template struct divides : binary_function { Т operator()(const T& x, const T& y) const { return x / y; } }; template struct modulus : binary_function { Т operator()(const T& x, const T& y) const { return x % y; } }; template struct negate : unary_function { Т operator()(const T& x) const { return -x; } };

Содержание раздела