Matching a type T to a list of case statements
I don't think returning the artificial false_ in case of no match is a good idea. Just return nothing, and you won't need false_ at all. Replace


: std::conditional&lt;match&lt;T, Key&gt;, Value, false_&gt;



with

: std::enable_if&lt;match&lt;T, Key&gt;, Value&gt;


It's interesting that while you support an explicit default-case, the last case is always treated as the default case anyway, if it isn't the only case. Oops?


template&lt;class T, class Key, class Value, class _, class Else&gt;
struct switch_&lt;T, case_&lt;Key, Value&gt;, case_&lt;_, Else&gt;&gt;
:
        std::conditional&lt;match&lt;T, Key&gt;, Value, Else&gt;
{};



By the way, if you restrict the default-case to being the last case, which you should consider doing anyway, you can replace match with std::is_same and some changes to switch_, making default_ its own class-template. Might be worth it.

What I failed to find is any way to avoid the recursion, sorry. I hope you can make good use of my feedback anyway.

Modified code:

namespace meta {

// Only for the example-program:
template&lt;auto N&gt;
using int_c = std::integral_constant&lt;decltype(N), N&gt;;

template&lt;class Key, class Value&gt;
struct case_;

template&lt;class Value&gt;
struct default_;

template&lt;class T, class... Cases&gt;
struct switch_
{
    static_assert(!sizeof...(Cases), "this meta::switch_ is malformed");
}

template&lt;class T, class Value&gt;
struct switch_&lt;T, default_&lt;Value&gt;&gt;
: std::enable_if&lt;true, Value&gt;
{}

template&lt;class T, class Key, class Value, class... Tail&gt;
struct switch_&lt;T, case_&lt;Key, Value&gt;, Tail...&gt;
: std::conditional_t&lt;std::is_same&lt;T, Key&gt;(),
    std::enable_if&lt;true, Value&gt;,
    switch_&lt;T, Tail...&gt;&gt;
{}

template&lt;class T, class... Cases&gt;
using switch_t = typename switch_&lt;T, Cases...&gt;::type;

}   // namespace meta