aboutsummaryrefslogtreecommitdiff
path: root/src/list/generator/iota.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list/generator/iota.h')
-rw-r--r--src/list/generator/iota.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/list/generator/iota.h b/src/list/generator/iota.h
new file mode 100644
index 0000000..54f0f40
--- /dev/null
+++ b/src/list/generator/iota.h
@@ -0,0 +1,34 @@
+#ifndef TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_
+#define TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_
+
+#include "operation/math.h"
+
+namespace tav {
+
+template <
+ typename Count,
+ typename Initial,
+ typename Step
+>
+struct Iota {
+ typedef Cons<
+ Initial,
+ typename Iota<
+ Substract<Count, Size<1>>,
+ Add<Initial, Step>,
+ Step
+ >::type
+ > type;
+};
+
+template <
+ typename Initial,
+ typename Step
+>
+struct Iota<Size<1>, Initial, Step> {
+ typedef Cons<Initial, void> type;
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_GENERATOR_IOTA_H_