The library provides basic function object classes for all of the arithmetic operators in the language ([expr.mul], [expr.add]).
template <class T> struct plus {
T operator()(const T& x, const T& y) const;
typedef T first_argument_type;
typedef T second_argument_type;
typedef T result_type;
};
operator() returns x + y.
template <class T> struct minus {
T operator()(const T& x, const T& y) const;
typedef T first_argument_type;
typedef T second_argument_type;
typedef T result_type;
};
operator() returns x - y.
template <class T> struct multiplies {
T operator()(const T& x, const T& y) const;
typedef T first_argument_type;
typedef T second_argument_type;
typedef T result_type;
};
operator() returns x * y.
template <class T> struct divides {
T operator()(const T& x, const T& y) const;
typedef T first_argument_type;
typedef T second_argument_type;
typedef T result_type;
};
operator() returns x / y.
template <class T> struct modulus {
T operator()(const T& x, const T& y) const;
typedef T first_argument_type;
typedef T second_argument_type;
typedef T result_type;
};
operator() returns x % y.
template <class T> struct negate {
T operator()(const T& x) const;
typedef T argument_type;
typedef T result_type;
};
operator() returns -x.