aboutsummaryrefslogtreecommitdiff
path: root/src/function/detail/apply.h
blob: c06fe686904c9e442e984fd61b1e1bdd253385e5 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef TYPEASVALUE_SRC_FUNCTION_DETAIL_APPLY_H_
#define TYPEASVALUE_SRC_FUNCTION_DETAIL_APPLY_H_

#include "placeholder.h"

namespace tav {

namespace detail {

template <
	template<typename...> class Function,
	typename...                 Arguments
>
struct apply_none {
	using type = Function<Arguments...>;
};

template <
	template<typename...> class Function,
	typename...                 Arguments
>
struct apply_variadic {
	template <typename... Partials>
	using function = Function<
		Eval<resolve_placeholder<
			List<Partials...>,
			Arguments
		>>...
	>;
};

template <
	template<typename...> class Function,
	typename...                 Arguments
>
struct apply_single : apply_variadic<Function, Arguments...> {
	template <typename Partial0>
	using function = typename apply_variadic<
		Function,
		Arguments...
	>::template function<Partial0>;
};

template <
	template<typename...> class Function,
	typename...                 Arguments
>
struct apply_pair : apply_variadic<Function, Arguments...> {
	template <typename Partial0, typename Partial1>
	using function = typename apply_variadic<
		Function,
		Arguments...
	>::template function<Partial0, Partial1>;
};

}

}

#endif  // TYPEASVALUE_SRC_FUNCTION_DETAIL_APPLY_H_