6#ifndef SL_UTILITY_FUNCTIONAL_ARITHMETIC_HPP
7#define SL_UTILITY_FUNCTIONAL_ARITHMETIC_HPP
25 inline constexpr auto plus = envelop<Transform>(
26 []<
class TLhs,
class TRhs>(TLhs&& lhs, TRhs&& rhs) ->
decltype(std::forward<TLhs>(lhs) + std::forward<TRhs>(rhs))
30 return std::forward<TLhs>(lhs) + std::forward<TRhs>(rhs);
36 inline constexpr auto minus = envelop<Transform>(
37 []<
class TLhs,
class TRhs>(TLhs&& lhs, TRhs&& rhs) ->
decltype(std::forward<TLhs>(lhs) - std::forward<TRhs>(rhs))
41 return std::forward<TLhs>(lhs) - std::forward<TRhs>(rhs);
48 []<
class TLhs,
class TRhs>(TLhs&& lhs, TRhs&& rhs) ->
decltype(std::forward<TLhs>(lhs) * std::forward<TRhs>(rhs))
52 return std::forward<TLhs>(lhs) * std::forward<TRhs>(rhs);
58 inline constexpr auto divides = envelop<Transform>(
59 []<
class TLhs,
class TRhs>(TLhs&& lhs, TRhs&& rhs) ->
decltype(std::forward<TLhs>(lhs) / std::forward<TRhs>(rhs))
63 return std::forward<TLhs>(lhs) / std::forward<TRhs>(rhs);
69 inline constexpr auto modulus = envelop<Transform>(
70 []<
class TLhs,
class TRhs>(TLhs&& lhs, TRhs&& rhs) ->
decltype(std::forward<TLhs>(lhs) % std::forward<TRhs>(rhs))
74 return std::forward<TLhs>(lhs) % std::forward<TRhs>(rhs);
80 inline constexpr auto negate = envelop<Transform>(
81 []<
class T>(T&&
value) ->
decltype(-std::forward<T>(
value))
83 static_assert(
concepts::negate<T>,
"Argument is not usable as operand of unary operator -.");
85 return -std::forward<T>(
value);
Determines whether two types can be used in operator / expressions.
Definition: operators.hpp:1067
Determines whether two types can be used in operator - expressions.
Definition: operators.hpp:907
Determines whether two types can be used in operator % expressions.
Definition: operators.hpp:1147
Determines whether two types can be used in operator * expressions.
Definition: operators.hpp:987
Determines whether a type can be used in operator - expression.
Definition: operators.hpp:804
Determines whether two types can be used in operator + expressions.
Definition: operators.hpp:827
Checks whether the given template type is usable as value type for unique_handle types.
Definition: unique_handle.hpp:161
constexpr auto modulus
Functional object which forwards the params to binary operator % and returns the result.
Definition: Arithmetic.hpp:69
constexpr auto plus
Functional object which forwards the params to binary operator + and returns the result.
Definition: Arithmetic.hpp:25
constexpr auto divides
Functional object which forwards the params to binary operator / and returns the result.
Definition: Arithmetic.hpp:58
constexpr auto negate
Functional object which forwards the param to unary operator - and returns the result.
Definition: Arithmetic.hpp:80
constexpr auto multiplies
Functional object which forwards the params to binary operator * and returns the result.
Definition: Arithmetic.hpp:47
constexpr auto minus
Functional object which forwards the params to binary operator - and returns the result.
Definition: Arithmetic.hpp:36
Definition: Arithmetic.hpp:13