aboutsummaryrefslogtreecommitdiff
path: root/src/function/apply.h
blob: f4de2923ff9c47b04cee215a90b0a06b22b14275 (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
#ifndef TYPEASVALUE_SRC_FUNCTION_APPLY_H_
#define TYPEASVALUE_SRC_FUNCTION_APPLY_H_

#include "operation/math.h"
#include "conditional/cond.h"

#include "detail/apply.h"

namespace tav {

typedef detail::placeholder<0> _0;
typedef detail::placeholder<1> _1;
typedef detail::placeholder<2> _2;
typedef detail::placeholder<3> _3;

template <
	template<typename...> class Function,
	typename...                 Arguments
>
struct Apply : Cond<
	Pair<
		GreaterThan<Eval<detail::count_placeholders<Arguments...>>, Size<2>>,
		detail::apply_variadic<Function, Arguments...>
	>,
	Pair<
		IsEqualValue<Eval<detail::count_placeholders<Arguments...>>, Size<2>>,
		detail::apply_pair<Function, Arguments...>
	>,
	Pair<
		IsEqualValue<Eval<detail::count_placeholders<Arguments...>>, Size<1>>,
		detail::apply_single<Function, Arguments...>
	>,
	Pair<
		Boolean<true>,
		detail::apply_none<Function, Arguments...>
	>
>::type { };

}

#endif  // TYPEASVALUE_SRC_FUNCTION_APPLY_H_