Can anyone please explain me the difference between this 2 functions?
template<typename T>
void f(T&& a) {
}
void f(int&& a) {
}
int main(){
int a = 3;
f(a);
}
If I only have the template version, the code compiles and works fine.
But if I remove the template and leave the int&& version, the compiler complains and I have to
transform the call into f(std::move(a)) in order to make it work.
Can anyone please explain me the difference here?
Thanks in advance.