Ok I have this code:
struct Mine{
template<typename T>
Mine(T&& x){
}
};
void nFoo(int&& x){
}
void sFoo(Mine x){
}
The nFoo
takes an int&&
directly, while the sFoo
does some finagling to get the same effect.
Consider this code:
nFoo(12); //Works
int x = 0;
nFoo(x); //Cannot bind int (lvalue) to int&&
sFoo(12); //Works
sFoo(x); //Works
Why does the int&&
sometimes allow binding from lvalue
s and sometimes not?
Aucun commentaire:
Enregistrer un commentaire