How do write a template which can decide which constructor to call?
<p>I'd like to be able to construct an A or B without having to think about the number of constructor arguments.</p>

<p>The second constructor is not legal C++ but I wrote it like this as an attempt to express what I want.</p>

<p>Is there an enable_if trick to selectively enable one of the constructors?</p>

<p>(e.g. depending on the number of constructor arguments of A and B.)</p>

<p>I need this to test about 15 classes with 1, 2 or 3 constructor arguments.</p>

<pre><code>struct A
{
    A(int x)
    {
    }
};

struct B
{
    B(int x, int y)
    {
    }
};

template&lt;typename T&gt;
struct Adaptor // second constructor is illegal C++.
{
    T t;

    Adaptor(int x, int y)
        : t(x)
    {
    }

    Adaptor(int x, int y) // error: cannot be overloaded
        : t(x, y)
    {
    }
};

int main()
{
    Adaptor&lt;A&gt; a(1,2);
    Adaptor&lt;B&gt; b(1,2);

    return 0;
}
</code></pre>
