aboutsummaryrefslogtreecommitdiff
path: root/src/function/apply.h
blob: 5a2105ce14497172ca2f85e9c718fd8550f3c568 (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<typename detail::count_placeholders<Arguments...>::type,  Size<2>>,
		detail::apply_variadic<Function, Arguments...>
	>,
	Pair<
		IsEqualValue<typename detail::count_placeholders<Arguments...>::type, Size<2>>,
		detail::apply_pair<Function, Arguments...>
	>,
	Pair<
		IsEqualValue<typename detail::count_placeholders<Arguments...>::type, Size<1>>,
		detail::apply_single<Function, Arguments...>
	>,
	Pair<
		Boolean<true>,
		detail::apply_none<Function, Arguments...>
	>
>::type { };

}

#endif  // TYPEASVALUE_SRC_FUNCTION_APPLY_H_