aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/reverse.h
blob: aabba92d20812229d815cbd833d12a7458abde09 (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
31
32
33
34
35
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_

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

namespace tav {

namespace detail {

template <typename Sequence>
class Reverse {
	private:
		template <
			typename Current,
			typename Previous
		>
		using reversed_append = tav::Append<
			Previous,
			tav::List<Current>
		>;

	public:
		typedef tav::Fold<reversed_append, void, Sequence> type;

};

}

template <typename Sequence>
using Reverse = Eval<detail::Reverse<Sequence>>;

}

#endif  // TYPEASVALUE_SRC_LIST_OPERATION_REVERSE_H_