title: C++ check whether constructor contains a parameter of given type
body: <p>With <code>std::is_constructible</code> one can question some given type for the presence of a certain constructor:</p>
  
  <pre><code>struct A {};
  struct B
  {
       explicit B(int, A, double) {}
  };
  
  int main()
  {
      std::cout&lt;&lt;std::is_constructible&lt;B,int,A,double&gt;::value&lt;&lt;std::endl; //prints true
  }
  </code></pre>
  
  <p>Suppose one does not know type <code>B</code>. Is there also a way to check whether there exists a constructor in <code>B</code> which contains type <code>A</code>, regardless of the other parameters? (--or, already sufficient, which contains type <code>A</code> in the n-th position?)</p>
  
  <hr>
  
  <p>Given a non-<code>explicit</code> constructor, I figured out a workaround by using a type which can be implicitly converted to anything:</p>
  
  <pre><code>struct convert_to_anything
  {
      template&lt;typename T&gt;
      operator T() const
      {
          return T{};    
      }
  };
  
  int main()
  {
      std::cout&lt;&lt;std::is_constructible&lt;B, convert_to_anything, A, convert_to_anything&gt;::value&lt;&lt;std::endl;
  }
  </code></pre>
  
  <p>(Actually, and unexpected to me, I found empirically that it seems to work as well when <code>explicit</code> is added to the constructor of <code>B</code> ... whereas I thought it would prevent from conversions?)</p>
  
  <p>Still, with this workaround I would have to test all possible numbers of parameters. Say for an <code>A</code> in the first position:</p>
  
  <pre><code>std::is_constructible&lt;B, A&gt;::value
  || std::is_constructible&lt;B, A, convert_to_anything&gt;::value
  || std::is_constructible&lt;B, A, convert_to_anything, convert_to_anything&gt;::value
  //... and so on up to a chosen maximum size.
  </code></pre>
  
  <p>That seems a bit unsatisfying. Do you have any better workarounds?</p>