Why operator= returns reference not const reference
- by outmind
The original question is related to overloading operator= and I like to share my findings as it was nontrivial for me to find them.
I cannot imagine reasonable example to use (a=b) as lvalue.
With the help of IRC and google I've found the next article:
http://msdn.microsoft.com/en-us/magazine/cc301415.aspx
it provides two examples.
(a=b)=c
f(T& );
f(a=b)
but both a bit not good, as first violate associativity and I believe that it is bad practice.
The second one give me the same feeling.
Could you provide more good examples why it should be non constant?