[arithmetic.operations] (original) (raw)
22 General utilities library [utilities]
22.10 Function objects [function.objects]
22.10.7 Arithmetic operations [arithmetic.operations]
22.10.7.1 General [arithmetic.operations.general]
22.10.7.2 Class template plus [arithmetic.operations.plus]
22.10.7.3 Class template minus [arithmetic.operations.minus]
22.10.7.4 Class template multiplies [arithmetic.operations.multiplies]
22.10.7.5 Class template divides [arithmetic.operations.divides]
22.10.7.6 Class template modulus [arithmetic.operations.modulus]
22.10.7.7 Class template negate [arithmetic.operations.negate]
22.10.7.1 General [arithmetic.operations.general]
The library provides basic function object classes for all of the arithmetic operators in the language ([expr.mul], [expr.add]).
22.10.7.2 Class template plus [arithmetic.operations.plus]
template<class T = void> struct plus { constexpr T operator()(const T& x, const T& y) const;};
constexpr T operator()(const T& x, const T& y) const;
template<> struct plus<void> { template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) + std::forward<U>(u));using is_transparent = _unspecified_;};
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) + std::forward<U>(u));
Returns: std::forward<T>(t) + std::forward<U>(u).
22.10.7.3 Class template minus [arithmetic.operations.minus]
template<class T = void> struct minus { constexpr T operator()(const T& x, const T& y) const;};
constexpr T operator()(const T& x, const T& y) const;
template<> struct minus<void> { template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) - std::forward<U>(u));using is_transparent = _unspecified_;};
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) - std::forward<U>(u));
Returns: std::forward<T>(t) - std::forward<U>(u).
22.10.7.4 Class template multiplies [arithmetic.operations.multiplies]
template<class T = void> struct multiplies { constexpr T operator()(const T& x, const T& y) const;};
constexpr T operator()(const T& x, const T& y) const;
template<> struct multiplies<void> { template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) * std::forward<U>(u));using is_transparent = _unspecified_;};
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) * std::forward<U>(u));
Returns: std::forward<T>(t) * std::forward<U>(u).
22.10.7.5 Class template divides [arithmetic.operations.divides]
template<class T = void> struct divides { constexpr T operator()(const T& x, const T& y) const;};
constexpr T operator()(const T& x, const T& y) const;
template<> struct divides<void> { template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) / std::forward<U>(u));using is_transparent = _unspecified_;};
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) / std::forward<U>(u));
Returns: std::forward<T>(t) / std::forward<U>(u).
22.10.7.6 Class template modulus [arithmetic.operations.modulus]
template<class T = void> struct modulus { constexpr T operator()(const T& x, const T& y) const;};
constexpr T operator()(const T& x, const T& y) const;
template<> struct modulus<void> { template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) % std::forward<U>(u));using is_transparent = _unspecified_;};
template<class T, class U> constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward<T>(t) % std::forward<U>(u));
Returns: std::forward<T>(t) % std::forward<U>(u).
22.10.7.7 Class template negate [arithmetic.operations.negate]
template<class T = void> struct negate { constexpr T operator()(const T& x) const;};
constexpr T operator()(const T& x) const;
template<> struct negate<void> { template<class T> constexpr auto operator()(T&& t) const -> decltype(-std::forward<T>(t));using is_transparent = _unspecified_;};
template<class T> constexpr auto operator()(T&& t) const -> decltype(-std::forward<T>(t));
Returns: -std::forward<T>(t).