Is returning a temp-object by reference possible
<p>is it possible to return a reference from a function like in this example code:</p>

<pre><code>string &amp;erase_whitespace(string &amp;text)
{
    text.erase(**etc.**);
    return text;
}
</code></pre>

<p>Call:</p>

<pre><code>string text = erase_whitespace(string("this is a test"));
cout &lt;&lt; test;
</code></pre>

<p>Does this code work? On Visual C++ it does not crash but it looks wrong.</p>

<p>Thanks</p>
