From 324988569183e38e9c5e42318571693a6fcd9569 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 16 Feb 2015 14:03:53 +0100 Subject: Simplified `List`, `Length` and `Reverse` implementations * continuation of 8e49cc6 * list constructor was generalized to a _variadic fold_ --- src/list/detail/fold_variadic.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/list/detail/fold_variadic.h (limited to 'src/list/detail/fold_variadic.h') diff --git a/src/list/detail/fold_variadic.h b/src/list/detail/fold_variadic.h new file mode 100644 index 0000000..e02b604 --- /dev/null +++ b/src/list/detail/fold_variadic.h @@ -0,0 +1,34 @@ +#ifndef TYPEASVALUE_SRC_LIST_DETAIL_FOLD_VARIADIC_H_ +#define TYPEASVALUE_SRC_LIST_DETAIL_FOLD_VARIADIC_H_ + +#include "type.h" + +namespace tav { + +namespace detail { + +template < + template class Function, + typename Head, + typename... Tail +> +struct fold_variadic { + typedef Function< + Head, + Eval> + > type; +}; + +template < + template class Function, + typename Head +> +struct fold_variadic { + typedef Function type; +}; + +} + +} + +#endif // TYPEASVALUE_SRC_LIST_DETAIL_FOLD_VARIADIC_H_ -- cgit v1.2.3