If T
were a parameter pack, you could use the following syntax to declare a function that takes a sequence of parameters with types corresponding to those in the parameter pack:
inline Class<T>::Test(const T&... t) { /* ... */ }
However, it appears that T
isn't a parameter pack. It's just a single type parameter. Plus, you put the ...
in the wrong place. So what you really did was declare a function that takes a single parameter of type T
, plus a C-style ellipsis. (Yes, the comma before the ellipsis is optional!)
So when you write sizeof...(t)
, the compiler complains because t
is not a pack. It's just a normal parameter.
Perhaps you wanted to declare Test
to be a function that takes an arbitrary number of arguments, but all of type const T&
? Unfortunately, there is no easy way to do that in current C++. See Specifying one type for all arguments passed to variadic function or variadic template function w/out using array, vector, structs, etc? for solutions.