aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/reverse.h
blob: 632fa5b5f509147d059baecd65927dc49e2d8d97 (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
29
30
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_

#include "append.h"
#include "higher/fold.h"

namespace tav {

template <typename List>
class Reverse {
	private:
		template <
			typename Current,
			typename Previous
		>
		struct reversed_append {
			typedef typename Append<
				Previous,
				Cons<Current, void>
			>::type type;
		};

	public:
		typedef typename Fold<reversed_append, void, List>::type type;

};

}

#endif  // TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_