memgraph/include/storage/model/properties/utils/math_operations.hpp
2016-08-10 09:39:02 +01:00

26 lines
581 B
C++

#pragma once
template <class Derived>
struct MathOperations
{
friend Derived operator+(const Derived& lhs, const Derived& rhs)
{
return Derived(lhs.value + rhs.value);
}
friend Derived operator-(const Derived& lhs, const Derived& rhs)
{
return Derived(lhs.value - rhs.value);
}
friend Derived operator*(const Derived& lhs, const Derived& rhs)
{
return Derived(lhs.value * rhs.value);
}
friend Derived operator/(const Derived& lhs, const Derived& rhs)
{
return Derived(lhs.value / rhs.value);
}
};