aboutsummaryrefslogtreecommitdiff
path: root/src/conditional/cond.h
blob: 2d6a41512eb63df585a9b4c91514573316f3db69 (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<Eval<Eval<Car<Pair>>>>;

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

};

}

#endif  // TYPEASVALUE_SRC_CONDITIONAL_COND_H_