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

We use cookies. Read the Privacy and Cookie Policy

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

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

template ‹class T›

struct plus: binary_function‹T, T, T› {

 Т operator()(const T& x, const T& y) const {return x + y;}

};

template ‹class T›

struct minus: binary_function‹T, T, T› {

 Т operator()(const T& x, const T& y) const {return x - y;}

};

template ‹class T›

struct times: binary_function‹T, T, T› {

 Т operator()(const T& x, const T& y) const (return x * y;}

};

template ‹class T›

struct divides: binary_function‹T, T, T› {

 Т operator()(const T& x, const T& y) const {return x / y;}

};

template ‹class T›

struct modulus: binary_function‹T, T, T› {

 Т operator()(const T& x, const T& y) const {return x % y;}

};

template ‹class T›

struct negate: unary_function‹T, T› {

 Т operator()(const T& x) const {return -x;}

};

Больше книг — больше знаний!

Заберите 20% скидку на все книги Литрес с нашим промокодом

ПОЛУЧИТЬ СКИДКУ