aboutsummaryrefslogtreecommitdiff
path: root/src/conditional/cond.h
blob: 0c2b1a8830c3ef4a0b320960281c25cd4e9edd5a (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
#ifndef TYPEASVALUE_SRC_CONDITIONAL_COND_H_
#define TYPEASVALUE_SRC_CONDITIONAL_COND_H_

#include <type_traits>

#include "list/list.h"
#include "list/operation/higher/find.h"

namespace tav {

template <typename... Branches>
class Cond {
	private:
		template <typename Pair>
		using predicate = IsTrue<typename Car<Pair>::type::type>;

	public:
		typedef typename Cdr<
			typename Find<
				predicate,
				typename List<Branches...>::type
			>::type
		>::type type;

};

}

#endif  // TYPEASVALUE_SRC_CONDITIONAL_COND_H_