Why assign a return value to a reference?
<p>I'm looking over some code, and all the calls to a function returning a string are assigned to a reference. The function prototype something like:</p>

<pre><code> std::string GetPath(const std::string&amp; top);
</code></pre>

<p>and it's used as </p>

<pre><code>std::string&amp; f = GetPath(cw);
</code></pre>

<p>or </p>

<pre><code> const std::string&amp; f = GetPath(cw);
</code></pre>

<p>Why would one use a reference here instead of </p>

<pre><code> std::string f = GetPath(cw);
</code></pre>
