aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/conditional/cond.h9
-rw-r--r--src/function/apply.h9
2 files changed, 13 insertions, 5 deletions
diff --git a/src/conditional/cond.h b/src/conditional/cond.h
index c543449..5f8014f 100644
--- a/src/conditional/cond.h
+++ b/src/conditional/cond.h
@@ -19,6 +19,15 @@ using Cond = Cdr<Eval<
detail::find_variadic<detail::cond_predicate, Branches...>
>>;
+template <
+ typename Condition,
+ typename Result
+>
+using Branch = Pair<Condition, Result>;
+
+template <typename Result>
+using Else = Branch<Boolean<true>, Result>;
+
}
#endif // TYPEASVALUE_SRC_CONDITIONAL_COND_H_
diff --git a/src/function/apply.h b/src/function/apply.h
index 591fa8a..553ae7f 100644
--- a/src/function/apply.h
+++ b/src/function/apply.h
@@ -18,20 +18,19 @@ template <
typename... Arguments
>
struct Apply : Cond<
- Pair<
+ Branch<
GreaterThan<detail::count_placeholders<Arguments...>, Size<2>>,
detail::apply_variadic<Function, Arguments...>
>,
- Pair<
+ Branch<
IsEqualValue<detail::count_placeholders<Arguments...>, Size<2>>,
detail::apply_pair<Function, Arguments...>
>,
- Pair<
+ Branch<
IsEqualValue<detail::count_placeholders<Arguments...>, Size<1>>,
detail::apply_single<Function, Arguments...>
>,
- Pair<
- Boolean<true>,
+ Else<
detail::apply_none<Function, Arguments...>
>
> { };