From 246cb31c1e20cdcc21a6a607de4b0095c71315d6 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 12 Feb 2015 14:32:33 +0100 Subject: Implemented `Cond` conditional * returns the `CDR` of the first true `CAR` in a given list of pairs * reimplemented `Apply` base class selection in terms of `Cond` --- src/conditional/cond.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/conditional/cond.h (limited to 'src/conditional') diff --git a/src/conditional/cond.h b/src/conditional/cond.h new file mode 100644 index 0000000..0c2b1a8 --- /dev/null +++ b/src/conditional/cond.h @@ -0,0 +1,29 @@ +#ifndef TYPEASVALUE_SRC_CONDITIONAL_COND_H_ +#define TYPEASVALUE_SRC_CONDITIONAL_COND_H_ + +#include + +#include "list/list.h" +#include "list/operation/higher/find.h" + +namespace tav { + +template +class Cond { + private: + template + using predicate = IsTrue::type::type>; + + public: + typedef typename Cdr< + typename Find< + predicate, + typename List::type + >::type + >::type type; + +}; + +} + +#endif // TYPEASVALUE_SRC_CONDITIONAL_COND_H_ -- cgit v1.2.3