I have a template class, with variadic argument list:
template<class ...Args>
struct Data{
};
Now I want to have constructor with variadic "universal reference" argument list, so I make my constructor templated:
template<class ...Args>
struct Data{
template<class ...CtrArgs>
Data(CtrArgs&& ... args){
// do something
}
};
And now I want to make an instance of Data:
Data<int, MyClass, bool> dat(1, MyClass(), false);
^^^^^^^^^^^^^^^^^^
Is this Args? Or CtrArgs?
The question is, does this <int, MyClass, bool> goes to Args, or to CtrArgs?
P.S. Maybe this is easy to check. But I ask this because I have very strange behavior in more complex case.
Data<int, MyClass, bool>isArgs.CtrArgsis then deduced from the constructor parameters asint, MyClass, bool.CtrArgscan only be deduced from the arguments given to the constructor.int&&, MyClass&&, bool&&?&&is added in your function argument list. The deduced types themselves are reference-less.T&, i.e., an lvalue reference, then reference collapsing turnsT& &&intoT&.