I was reading about "perfect forwarding". Why does this only work with a template:
// example from justsoftwaresolutions
void g(X&& t); // 2
void g(X& t); // 1
template<typename T>
void f(T&& t)
{
g(std::forward<T>(t));
}
int main()
{
X x;
f(x); // 1
f(X()); // 2
}
What is function is generated from the template for f(x) and f(X()) ?
What does std:forward