This question already has an answer here:
- Variable number of arguments in C++? 16 answers
- C++ Variadic Function Templates of Known Type 3 answers
In modern C++(ie, version>=11), what is best way to implement a function with a variables number of int parameters?
I only want int
s, not a general type.
void foo(/*WHAT'S HERE*/) {
// and how do I access the arguments here?
}
int main()
{
foo(34,1);
foo(9,2,66,1);
// etc
return 0;
}
Aucun commentaire:
Enregistrer un commentaire