EDIT1: I think I missed the first question.
The standard says: 3.10 Lvalues and rvalues
The result of calling a function that does not return an Rvalue reference. User-defined function operators and whether such operators calculate or give lvalues by their parameter and return types.
, , . , l. , :
47) , , , , - , lvalues.
, :
AMethod() = YourClass();
AMethod , :
AMethod().operator=(YourClass());
. , l. , ++ , r-!:
5;;;
EDIT2:
:
if( &(YourClass() + YourClass()) == &YourClass() )
{
....
}
&(YourClass() + YourClass()) l, . VC, :
warning C4238: nonstandard extension used : class rvalue used as lvalue
, ++, VC !
. -, YourClass AMethod. . , ++ , . , , const YourClass. " ":
const YourClass AMethod(){ return YourClass();}
, . , operator+ , const .
friend YourClass operator+(const YourClass& lhs, const YourClass& rhs)
{
...
}
, , :
(a + b) = c;
(a + b) , , , , .