I was surprised when the following worked
template<typename T>
void f(T &...);
I thought that I have to declare "T" as "typename ...T" then, and that it only works in C++0x. But the above compiled in strict C++03 mode. What's going on?
It's just the bad old C varargs syntax; the grammar allows omitting the comma. The following are equivalent:
int printf(const char* fmt, ...);
int printf(const char* fmt...);
Did you call the function? Template functions don't get compiled until you call them. And in Visual Studio 2010, IntelliSense shows the real syntax of that function would be
template <class T> void f(T&, ...)
Smells like old variable argument syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With