aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/fold.h
blob: 3ed0a42f169025d56e7db0ad41bb24ce6c48a4fb (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 Eval<Function<
		Head<Current>,
		Eval<Fold<Function, Initial, Tail<Current>>>
	>> 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_