aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/list/list.h32
-rw-r--r--src/list/operation/basic.h21
-rw-r--r--src/list/operation/concatenate.h27
3 files changed, 51 insertions, 29 deletions
diff --git a/src/list/list.h b/src/list/list.h
index f21d0fc..b0fe407 100644
--- a/src/list/list.h
+++ b/src/list/list.h
@@ -27,35 +27,9 @@ using Head = Car<Cons>;
template <typename Cons>
using Tail = Cdr<Cons>;
-template <typename Cons>
-struct Length {
- typedef Add<Size<1>, typename Length<Cdr<Cons>>::type> type;
-};
-
-template <>
-struct Length<void> {
- typedef Size<0> type;
-};
-
-template <
- typename Primary,
- typename Secondary
->
-struct Concatenate {
- typedef Cons<
- Head<Primary>,
- typename Concatenate<
- Tail<Primary>,
- Secondary
- >::type
- > type;
-};
-
-template <typename Secondary>
-struct Concatenate<void, Secondary> {
- typedef Secondary type;
-};
-
}
+#include "operation/basic.h"
+#include "operation/concatenate.h"
+
#endif // TYPEASVALUE_SRC_LIST_LIST_H_
diff --git a/src/list/operation/basic.h b/src/list/operation/basic.h
new file mode 100644
index 0000000..1e05a50
--- /dev/null
+++ b/src/list/operation/basic.h
@@ -0,0 +1,21 @@
+#ifndef TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
+#define TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
+
+namespace tav {
+
+template <typename Cons>
+struct Length {
+ typedef Add<
+ Size<1>,
+ typename Length<Tail<Cons>
+ >::type> type;
+};
+
+template <>
+struct Length<void> {
+ typedef Size<0> type;
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
diff --git a/src/list/operation/concatenate.h b/src/list/operation/concatenate.h
new file mode 100644
index 0000000..21eb1ee
--- /dev/null
+++ b/src/list/operation/concatenate.h
@@ -0,0 +1,27 @@
+#ifndef TYPEASVALUE_SRC_LIST_OPERATION_CONCATENATE_H_
+#define TYPEASVALUE_SRC_LIST_OPERATION_CONCATENATE_H_
+
+namespace tav {
+
+template <
+ typename Primary,
+ typename Secondary
+>
+struct Concatenate {
+ typedef Cons<
+ Head<Primary>,
+ typename Concatenate<
+ Tail<Primary>,
+ Secondary
+ >::type
+ > type;
+};
+
+template <typename Secondary>
+struct Concatenate<void, Secondary> {
+ typedef Secondary type;
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_CONCATENATE_H_