A function with variable number of arguments with known types, the c++11 way

后端 未结 2 2042
刺人心
刺人心 2020-12-09 09:38

I already know the stdarg.h way to have a function with variable arguments in c++ as discussed here for example. I also know c++11 standard has variadic templat

2条回答
  •  萌比男神i
    2020-12-09 10:04

    If variable parameters are all of one type, you can change the function signature to take an array of those types instead of using the '...'.

提交回复
热议问题