aboutsummaryrefslogtreecommitdiff
path: root/src/operation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/operation.h')
-rw-r--r--src/operation.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/operation.h b/src/operation.h
new file mode 100644
index 0000000..c906b55
--- /dev/null
+++ b/src/operation.h
@@ -0,0 +1,36 @@
+#ifndef TYPEASVALUE_SRC_OPERATION_H_
+#define TYPEASVALUE_SRC_OPERATION_H_
+
+#include "type.h"
+
+namespace tav {
+
+template <
+ typename X,
+ typename Y
+>
+struct add {
+ static_assert(
+ equal_type<X, Y>::value,
+ "only values of the same type may be added"
+ );
+
+ typedef Int<X::value + Y::value> type;
+};
+
+template <
+ typename X,
+ typename Y
+>
+struct substract {
+ static_assert(
+ equal_type<X, Y>::value,
+ "only values of the same type may be substracted"
+ );
+
+ typedef Int<X::value - Y::value> type;
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_OPERATION_H_