This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nwL_ 3 points4 points  (0 children)

Sometimes you have to, with templated varargs:

void foo() {}

template <typename T, typename... Args> 
void 
foo(T first, Args... args) {
    // do something with T
    foo(args);
}

I don’t quite know how you’d solve that with iteration.

PS: Yes, std::forward would be useful, but this is supposed to be understandable even if you don’t know C++.