aboutsummaryrefslogtreecommitdiff
path: root/src/function/apply.h
blob: 402b654f667ea9150547d93a793fc9a3902b0174 (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
#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
>
using Apply = Cond<
	Branch<
		GreaterThan<detail::count_placeholders<Arguments...>, Size<2>>,
		detail::apply_variadic<Function, Arguments...>
	>,
	Branch<
		IsEqualValue<detail::count_placeholders<Arguments...>, Size<2>>,
		detail::apply_pair<Function, Arguments...>
	>,
	Branch<
		IsEqualValue<detail::count_placeholders<Arguments...>, Size<1>>,
		detail::apply_single<Function, Arguments...>
	>,
	Else<
		detail::apply_none<Function, Arguments...>
	>
>;

}

#endif  // TYPEASVALUE_SRC_FUNCTION_APPLY_H_