I have a really simple func definition here:
void testRvalue(int&& r)
{
printf("rvalue ref is called\n");
testRvalue(r); // this line gives "no known conversion from 'int' to 'int &&' for 1st argument"
}
I mean... inside this function, what is the type of r? Isn't it int&& (the parameter is int&& r so how come r is not of type int&&?) If so why can't I pass this r to this func itself, which takes a int&& type as parameter?
What is the type of r exactly? int&& or int? If int, why???
Aucun commentaire:
Enregistrer un commentaire