aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/reverse.h
blob: 7a0305c6d6b9238223683786bbe0a1be1ea45c2e (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 "concatenate.h"
#include "higher/fold.h"

namespace tav {

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

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

};

}

#endif  // TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_