diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conditional/cond.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/conditional/cond.h b/src/conditional/cond.h index 5f8014f..ca5e46d 100644 --- a/src/conditional/cond.h +++ b/src/conditional/cond.h @@ -12,12 +12,20 @@ namespace detail { template <typename Pair> using cond_predicate = IsTrue<Car<Pair>>; +template <typename... Branches> +struct select_cond_branch { + using type = Eval<detail::find_variadic<detail::cond_predicate, Branches...>>; + + static_assert( + IsPair<type>::value, + "all branch conditions resolve to false" + ); +}; + } template <typename... Branches> -using Cond = Cdr<Eval< - detail::find_variadic<detail::cond_predicate, Branches...> ->>; +using Cond = Cdr<Eval<detail::select_cond_branch<Branches...>>>; template < typename Condition, |