Content deleted Content added
m Signing comment by 2.94.232.187 - "→Non-reference return types: " |
|||
Line 328:
Unless I'm wrong, there's something amiss with the return types of most overloaded binary operators as shown on the page. They return values, not references, but use reference arguments (right hand operands). This means that in their current state as shown on the page, they cannot be used in right-to-left algebraic expressions (e.g.: a + (b + c) will trigger a compiler error, unless (b + c) is stored in a variable first and used as such).--[[User:Printz150|Printz150]] ([[User talk:Printz150|talk]]) 18:58, 25 February 2012 (UTC)
:No. Since binary operator always returns a result without changing one of the operands, this result is saved and returned via temp variable. Since you cannot return reference to temp variable :you should do it by value <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/2.94.232.187|2.94.232.187]] ([[User talk:2.94.232.187|talk]]) 16:08, 9 November 2012 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
|