Did some searching and couldn't find an answer to this question so apologies if a repost. I want to call the same function with the same arg on a bunch of different objects. I currently implemented it like this:
void callWithArg(const char* msg) { }
template <typename HEAD, typename.... TAIL>
void callWithArg(HEAD&& head, TAIL&&... tail, const char* msg) {
head.foo(msg);
callWithArg(tail..., msg);
}
Obviously that in itself is not a particularly tedious bit of code, I was just wondering if there was a simpler or cleaner way of iterating over that parameter pack than this kind of recursive invocation? Thanks!