jeudi 21 novembre 2019

Modern C++ best way to implement a function with a variable number of int parameters [duplicate]

This question already has an answer here:

In modern C++(ie, version>=11), what is best way to implement a function with a variables number of int parameters?

I only want ints, 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