3

What is the difference between the two functions?

template <class ...Types> void f(Types... args...){}
template <class ...Types> void g(Types... args){}
ZhangXiongpang
  • 280
  • 2
  • 7

1 Answers1

7

f is exactly the same as

template <class ...Types> void f(Types... args, ...){}
//                                            ^^^^^

I.e., it's just a plain old variadic parameter list from C. For historical reasons, it can be used without the usual , that is needed to seperate parameters. The difference to g is exactly that parameter.

Note that no arguments will ever be passed to the C-style variadic parameter list, since the C++-style variadic parameters will "swallow" all arguments.

Xeo
  • 129,499
  • 52
  • 291
  • 397