title: implementing a switch type trait (with std::conditional_t chain calls)
body: <p>this is what i want, a "switch" type trait that returns the first type which has a condition == true:</p>
  
  <pre><code>ext::select_t&lt;condition1 == true, Type1,
                condition2 == true, type2,
                condition3 == true, type3&gt;
  </code></pre>
  
  <p>etc, and be able to add as many condition / type pairs as i want.</p>
  
  <p>i can do this with std::conditional as such (random example):</p>
  
  <pre><code>template&lt;typename Number,
           typename Distribution = std::conditional_t&lt;
                   // IF
                   std::is_integral&lt;Number&gt;::value,
                   // RETURN INT
                   std::uniform_int_distribution&lt;Number&gt;,
                   // ELSE
                   std::conditional_t&lt;std::is_floating_point&lt;Number&gt;::value,
                                      // RETURN REAL
                                     std::uniform_real_distribution&lt;Number&gt;, void&gt;&gt;&gt;
  
  Number random(Number min, Number max)
  {
      static std::random_device rd;
      static std::mt19937 mt(rd());
  
      Distribution dist(min, max);
  
      return dist(mt);
  }
  </code></pre>
  
  <p>as you can see it decides at compile time what kind of distribution i want depending on the conditions/types passed.</p>
  
  <p>obviously this can get real ugly real fast if i try to add more conditions, imagine i want 10 of them.</p>
  
  <p>so i tried to build one, but failed miserably:</p>
  
  <pre><code>template&lt;bool B, typename T&gt;
  struct cond
  {
      static constexpr bool value = B;
      using type = T;
  };
  
  template&lt;typename Head, typename... Tail&gt;
  struct select
  {
      using type = std::conditional_t&lt;Head::value, typename Head::type, select&lt;Tail...&gt;&gt;;
  };
  
  template&lt;typename Head&gt;
  struct select&lt;Head&gt;
  {
      using type = std::conditional_t&lt;Head::value, typename Head::type, void&gt;;
  };
  
  template&lt;typename Head, typename... Tail&gt;
  using select_t = typename select&lt;Head, Tail...&gt;::type;
  </code></pre>
  
  <p>the reason i tried to make a cond structure is so i can get "pairs" of conditions/types, so i can get any number of those using variadic templates, but this makes it even more uglier (and not working):</p>
  
  <pre><code>using Type = std::select_t&lt;cond&lt;false, void&gt;,
                             cond&lt;false, int&gt;,
                             cond&lt;true, std::string&gt;&gt;;
  </code></pre>
  
  <p>not only it doesn't look as good as i want the final version to be, but it doesn't even work! it only works when the first condition is true..</p>
  
  <p>is there anything im missing? also how could i achieve this in a more clean way (at least for the end user).</p>
  
  <p>thanks in advance.</p>