Consider:
template <typename... Args>
void foo(Args... args) {
bar(std::forward<Args>(args)...);
}
template <typename... Args>
void foo2(Args&&... args) {
bar(std::forward<Args>(args)...);
}
I understand the perfect rvalue references forwarding in case of foo2
, but what is the purpose of forwarding the variadic argument values of foo
?
What would be different if foo
would look like this?
template <typename... Args>
void foo(Args... args) {
bar(args...);
}