I have read this, this, this and many others... but none of these posts answers or is applicable to my specific problem.
I have a struct X
with a variadic template constructor:
struct X
{
template<typename... T>
X(T... t) { /*...*/ }
};
And I have a structure Y
that contains two objects of type X
. I would like to define a template constructor for Y
, allowing to properly initialize both members of type X
with distinct parameters list, ie something that looks like the following code (which obviously does not work):
struct Y
{
template<typename... U, typename... V>
Y(U&&... u, V&&... v) // this does not work
: x1(std::forward(u)...), x2(std::forward(v)...) // this is was I need to do
{}
X x1, x2;
};
How could I do that, using wrappers, tuples or any suitable metaprogramming machinery ? A C++14 solution is acceptable.