title: How do I filter a tuple of types depending on whether an expression is valid in Boost.Hana?
body: <p>In a reduced example I have two types with in a tuple and I want to create another tuple that only contains the types where an expression is valid (in this example I'm using the + operator).</p>
  
  <p>My attempt is like so:</p>
  
  <pre><code>#include &lt;boost/hana.hpp&gt;
  #include &lt;boost/hana/experimental/printable.hpp&gt;
  
  #include &lt;iostream&gt;
  
  namespace hana = boost::hana;
  
  struct foo {};
  
  const auto result{hana::filter(hana::tuple_t&lt;int, foo&gt;, [](auto type) {
    const auto has_plus{hana::is_valid([](auto t)
      -&gt; decltype((void) hana::traits::declval(t) + hana::traits::declval(t)) {})};
  
    return has_plus(type);
  })};
  
  int main()
  {
    std::cout &lt;&lt; hana::experimental::print(result) &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>This outputs '()', ie. no types matched where I would expect that the tuple <code>result</code> should contain <code>type&lt;int&gt;</code>.</p>
  
  <p>I am using the Boost.Hana version that is packaged with Boost 1.62.</p>