Query about temporary objects
<p>In Exceptional C++, item 10, its talking about use of a temporary (if you have the book, top of page 35 "... namely, the copy of the returned temporary into the destination").</p>

<p>The code is</p>

<pre><code>template&lt;class T&gt;
T Stack::&lt;T&gt;::Pop()
{
...
T result = ...
return result;
}

...


string s1(s.Pop());
</code></pre>

<p>I'm not quite clear on what temporary is being created where and why.</p>

<p>When you return an object by value from a function is a temporary always created? Why and what's its scope?
In this case s1 is being copy constructed, presumably from the temporary? Why can it not be constructed from the result object within the function?</p>

<p>TIA</p>

<p>------- EDIT ---------
I think I got confused because the book is using the term copy, and its using it with the meaning of an operation while I was thinking of it meaning duplicate.
Verr good clear book in general, but this particular paragraph perhaps isn't as clear as it could be.</p>
