aboutsummaryrefslogtreecommitdiff
path: root/src/operation/math.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/operation/math.h')
-rw-r--r--src/operation/math.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/operation/math.h b/src/operation/math.h
new file mode 100644
index 0000000..64a5cdb
--- /dev/null
+++ b/src/operation/math.h
@@ -0,0 +1,54 @@
+#ifndef TYPEASVALUE_SRC_OPERATION_MATH_H_
+#define TYPEASVALUE_SRC_OPERATION_MATH_H_
+
+#include "type.h"
+
+namespace tav {
+
+template <
+ typename X,
+ typename Y
+>
+struct add {
+ typedef std::integral_constant<
+ decltype(X::value + Y::value),
+ X::value + Y::value
+ > type;
+};
+
+template <
+ typename X,
+ typename Y
+>
+struct substract {
+ typedef std::integral_constant<
+ decltype(X::value - Y::value),
+ X::value - Y::value
+ > type;
+};
+
+template <
+ typename X,
+ typename Y
+>
+struct multiply {
+ typedef std::integral_constant<
+ decltype(X::value * Y::value),
+ X::value * Y::value
+ > type;
+};
+
+template <
+ typename X,
+ typename Y
+>
+struct divide {
+ typedef std::integral_constant<
+ decltype(X::value / Y::value),
+ X::value / Y::value
+ > type;
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_OPERATION_MATH_H_