aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/fold.h
blob: 6ad4bd7fd2d6525992944a406d4c5422b8033a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FOLD_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FOLD_H_

namespace tav {

template <
	template<typename, typename> class Function,
	typename                           Initial,
	typename                           Current
>
struct Fold {
	typedef typename Function<
		Head<Current>,
		typename Fold<Function, Initial, Tail<Current>>::type
	>::type type;
};

template <
	template<typename, typename> class Function,
	typename                           Initial
>
struct Fold<Function, Initial, void> {
	typedef Initial type;
};

}

#endif  // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FOLD_H_