diff options
Diffstat (limited to 'src/list/operation/higher/fold.h')
-rw-r--r-- | src/list/operation/higher/fold.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/list/operation/higher/fold.h b/src/list/operation/higher/fold.h index 3ed0a42..7364fe5 100644 --- a/src/list/operation/higher/fold.h +++ b/src/list/operation/higher/fold.h @@ -3,16 +3,18 @@ namespace tav { +namespace detail { + template < template<typename, typename> class Function, typename Initial, typename Current > struct Fold { - typedef Eval<Function< + typedef Function< Head<Current>, Eval<Fold<Function, Initial, Tail<Current>>> - >> type; + > type; }; template < @@ -25,4 +27,13 @@ struct Fold<Function, Initial, void> { } +template < + template<typename, typename> class Function, + typename Initial, + typename Current +> +using Fold = Eval<detail::Fold<Function, Initial, Current>>; + +} + #endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FOLD_H_ |