![]() |
От: |
rg45
|
|
Дата: | 31.01.25 19:07 | ||
Оценка: |
int& lvalue(int&& i)
{
return i; // error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
}
In general, the effect of this rule is that named rvalue references are treated as lvalues and unnamed rvalue references to objects are treated as xvalues; rvalue references to functions are treated as lvalues whether named or not.
int& lvalue(int&& i)
{
int& r = i; // OK
return r;
}