aboutsummaryrefslogtreecommitdiff
path: root/src/conditional/cond.h
blob: f6b79650077e5eb5bc892a1dd75d0c43b94d6193 (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
#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 {

namespace detail {

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

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

};

}

template <typename... Branches>
using Cond = Eval<detail::Cond<Branches...>>;

}

#endif  // TYPEASVALUE_SRC_CONDITIONAL_COND_H_