aboutsummaryrefslogtreecommitdiff
path: root/src/list/detail/find_variadic.h
blob: 824f3851f1865195c3dc5c03cfe5b6ca19af28cf (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_LIST_DETAIL_FIND_VARIADIC_H_
#define TYPEASVALUE_SRC_LIST_DETAIL_FIND_VARIADIC_H_

#include "type.h"
#include "conditional/if.h"

namespace tav {

namespace detail {

template <
	template<typename> class Predicate,
	typename                 Head,
	typename...              Tail
>
struct find_variadic {
	typedef If<
		Eval<Predicate<Head>>,
		Head,
		Eval<find_variadic<Predicate, Tail...>>
	> type;
};

template <
	template<typename> class Predicate,
	typename                 Last
>
struct find_variadic<Predicate, Last> {
	typedef If<
		Eval<Predicate<Last>>,
		Last,
		void
	> type;
};

}

}

#endif  // TYPEASVALUE_SRC_LIST_DETAIL_FIND_VARIADIC_H_