title: SFINAE in variadic constructor
body: <p>I want to define a generic strong alias type, i.e. a type</p>
  
  <pre><code>template&lt;typename T, auto ID = 0&gt;
  class StrongAlias {
      T value;
  };
  </code></pre>
  
  <p>such that for a type <code>T</code> a <code>StrongAlias&lt;T&gt;</code> can be used in exactly the same way as <code>T</code>, but <code>StrongAlias&lt;T, 0&gt;</code> and <code>StrongAlias&lt;T, 1&gt;</code> are different types that can not be implecitly converted to each other.
  In order to mimic a <code>T</code> as perfectly as possible, I would like my <code>StrongAlias</code> to have the same constructors as <code>T</code>.
  This means I would like to do something like the following:</p>
  
  <pre><code>template&lt;typename T, auto ID = 0&gt;
  class StrongAlias {
      T value;
  public:
      // doesn't work
      template&lt;typename... Args, typename = std::enable_if_t&lt;std::is_constructible_v&lt;T, Args...&gt;&gt;&gt;
      StrongAlias(Args&amp;&amp;... args) noexcept(std::is_nothrow_constructible_v&lt;T, Args...&gt;)
          : value(std::forward&lt;Args&gt;(args)...) {}
  };
  </code></pre>
  
  <p>except that this wouldn't work since the <code>template parameter pack must be the last template parameter</code>, as clang 5.0 would tell me.
  The other way to use SFINAE that I thought of would be in the return type, but since a constructor doesn't have a return type, this does not seem to work either.</p>
  
  <p>Is there any way to use SFINAE on a variadic template parameter pack in a constructor?</p>
  
  <p>Alternatively, if there isn't one, can I accomplish what I want in another way?</p>
  
  <p>Note that being implicitly constructible from a <code>T</code> isn't enough in my case, as the example of <code>StrongAlias&lt;std::optional&lt;int&gt;&gt;</code> shows: If <code>StrongAlias</code> can only be implictly constructed from a <code>std::optional&lt;int&gt;</code>, it cannot be be constructed from a <code>std::nullopt</code> (of type <code>std::nullopt_t</code>), because that would involve 2 user-defined conversions. I really want to have all constructors of the aliased type.</p>
  
  <p>EDIT:
  Of course it would be possible to implement this without SFINAE and let the program be invalid if a <code>StrongAlias</code> is constructed from incompatible arguments. However, while this would be an acceptable behaviour in my specific case, it is clearly not optimal as the <code>StrongAlias</code> may be used in a template that queries if the given type is constructible from some arguments (via <code>std::is_constructible</code>). While this would yield a <code>std::false_type</code> for <code>T</code>, it would result in a <code>std::true_type</code> for <code>StrongAlias&lt;T&gt;</code>, which could mean unnecessary compile errors for <code>StrongAlias&lt;T&gt;</code> that wouldn't exist for <code>T</code>.</p>