I have the following class template:
template
class MyClass;
where T is some type, N - num
Maybe like this:
#include
#include
template
class MyClass
{
template
typename std::enable_if, Args...>::value>::type
foo(Args &&... args)
{
// for example:
MyClass m(std::forward(args)...);
// ...
}
};
This will work only if MyClass has a constructor that accepts the relevant arguments directly (like MyClass(A1, A2, A3)), but I don't think it works if MyClass has a constructor that requires an initializer list, nor will it work if MyClass is an aggregate that requires brace-initialization.
That said, it doesn't look like your MyClass could possibly accept an initializer list, since you said that it has to take precisely N arguments, which an IL cannot promise.