I'm trying to implement a delegate class following Herb Sutter's Example. There is a sections in this article that duplicates several templates; one template for the number of arguments in the list (Example 7, lines 41 - 59)1. I'm trying to replace this with a variadic template.
void operator()() const {
for_each(begin(l_), end(l_), []( function<F> i) {
i();
});
}
template<typename... Ts>
void operator()(Ts... vs) const {
for_each(begin(l_), end(l_), [&, vs...]( function<F> i) //g++-4.6.1: expected ',' before '...' token; expected identifier before '...' token
{
i(vs...);
});
}
I found this answer, but I think my issue is the vs isn't expanding. What is the correct way to do this?