I have a class Base
and MyFunc
templates with parameter packs.
I have a class Derived
, which specifies a const T&
type in the parameter pack.
template <typename... T>
class Base {};
template <typename... T>
void MyFunc(Base<T...>, T... t) {}
class Derived : public Base<const int&> {};
void Test() { MyFunc(Derived(), 1); }
This yields the error:
deduced conflicting types for parameter 'T' (<const int &> vs. <int>)
How can I make this work so that I can use const T&
in the parameter pack?
New contributor
Nick Golob is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.