Lifetime of temporary within operator+ sequence
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/584824/guaranteed-lifetime-of-temporary-in-c">Guaranteed lifetime of temporary in C++?</a><br>
  <a href="http://stackoverflow.com/questions/4214153/lifetime-of-temporaries">Lifetime of temporaries</a>  </p>
</blockquote>



<p>I have a quick question regarding the lifespan of a temporary object, when returned from an overloaded <code>operator+</code> method. For example, if the expression...</p>

<pre><code>a = b + c + d + e
</code></pre>

<p>...is evaluated by overloaded <code>operator+</code> methods which return temporary objects, is the scope of the temporary returned by the sub-expression <code>b + c</code> that of the entire expression?</p>

<p>As g++ appears to hold onto all temporaries whilst the entire expression is within scope, references to these values may be held for delayed evaluation during the <code>a =</code> assignment.</p>

<p>Could somebody please confirm whether or not this behaviour is guaranteed for all C++ implementations?</p>
