J
Jarek Blakarz
Hi
The following program does not compile on g++ version 4.5.4.
It gives the following error message:
cannot bind ‘int’ lvalue to ‘int&&’
I understand why it does not compile.
On the other hand it compiles successfully on the older version of g++.
Today I'm not sure but I think that once I found something on the internet
saying:
"&& accepts both lvalues and rvalues"
My feeling is that "&&" should accept only rvalues.
Please write me what is the correct behaviour.
thanks a lot for explanation.
void fun(int &&arg) {}
int main ( void )
{
int speed = 10;
fun(speed); // compilation error
return 0;
}
The following program does not compile on g++ version 4.5.4.
It gives the following error message:
cannot bind ‘int’ lvalue to ‘int&&’
I understand why it does not compile.
On the other hand it compiles successfully on the older version of g++.
Today I'm not sure but I think that once I found something on the internet
saying:
"&& accepts both lvalues and rvalues"
My feeling is that "&&" should accept only rvalues.
Please write me what is the correct behaviour.
thanks a lot for explanation.
void fun(int &&arg) {}
int main ( void )
{
int speed = 10;
fun(speed); // compilation error
return 0;
}