Based on the recipe found here, I wrote the following:
void printInt(int a) {std::cout << a << std::endl;}
template <typename... Args>
void f(const Args &... args) {
auto temp = {(printInt(args), void(), 0)...};
auto a = temp; temp = a;
}
Two questions:
-
What does this syntax mean:
{(printInt(args), void(), 0)...}
? -
I added the line
auto a = temp; temp = a;
in order to not get a warning about the unused variabletemp
. Is there a better way?
Aucun commentaire:
Enregistrer un commentaire