title: C++11 string assignment operator
body: <p>Look at this code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;fstream&gt;
  #include &lt;iterator&gt;
  
  using namespace std;
  
  int main()
  {
  ifstream text("text.txt");
  
  istreambuf_iterator&lt;char&gt; iis(text);
  string longest_phrase, _longest;
  
  while (iis != istreambuf_iterator&lt;char&gt;()) {
      if ( *iis != '.' ) {
          _longest.push_back(*iis);
          ++iis;
          continue;
      }
      if ( _longest.size() &gt; longest_phrase.size() )
          longest_phrase = move(_longest); //I want to move the data of _longest to longest_phrase. Just move! Not to copy!
      cout &lt;&lt; _longest.empty(); //why _longest is not empty??
              //_longest.clear();
      ++iis;
  }
  text.close();
  longest_phrase.push_back('.');
  cout &lt;&lt; "longest phrase is " &lt;&lt; longest_phrase;
  return 0;
  }
  </code></pre>
  
  <p>This code searches for the longest phrase in file. 
  So why the conversion from lvalue to rvalue doesnt work?</p>
  
  <p>Edit:
  That's why I thought that it did not work:    </p>
  
  <pre><code>class Vector {
  public:
      Vector(vector&lt;int&gt; &amp;&amp;v): vec( move(v) ) {}
      vector&lt;int&gt; vec;
  };
  
  int main()
  {
      vector&lt;int&gt; ints(50, 44);
      Vector obj( move(ints) );
      cout &lt;&lt; ints.empty();
      return 0;
  }
  </code></pre>
  
  <p>Thank you all for the quick and helpful answers!</p>