Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这两个功能有什么区别?
template <class ...Types> void f(Types... args...){} template <class ...Types> void g(Types... args){}
f完全一样
f
template <class ...Types> void f(Types... args, ...){} // ^^^^^
即,它只是 C 中的一个普通的老式可变参数列表。由于历史原因,它可以在没有,分隔参数所需的常用参数的情况下使用。的区别g正是那个参数。
,
g
请注意,不会将任何参数传递给 C 风格的可变参数列表,因为 C++ 风格的可变参数将“吞下”所有参数。