aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/list/operation/basic.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/list/operation/basic.h b/src/list/operation/basic.h
index 1e05a50..cee4cbc 100644
--- a/src/list/operation/basic.h
+++ b/src/list/operation/basic.h
@@ -1,6 +1,8 @@
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
+#include "operation/math.h"
+
namespace tav {
template <typename Cons>
@@ -16,6 +18,23 @@ struct Length<void> {
typedef Size<0> type;
};
+template <
+ typename Index,
+ typename Cons
+>
+struct Nth {
+ typedef If<
+ equal_value<Index, Size<0>>::value,
+ Head<Cons>,
+ typename Nth<Substract<Index, Size<1>>, Tail<Cons>>::type
+ > type;
+};
+
+template <typename Index>
+struct Nth<Index, void> {
+ typedef void type;
+};
+
}
#endif // TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_