title: strange behavior of returning a vector
body: <p>I have the following problem:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  using namespace std;
  
  
  class Mat {
  public:
  
          typedef vector&lt;float&gt;::size_type size_type;
  
          Mat (size_type k, size_type m)
          :data_(k*m){}
  
          inline vector&lt;float&gt; data() const {return data_;}
  
          vector&lt;float&gt; data_;
  };
  
  int main(){
  
      Mat f (6, 10);
  
      cout &lt;&lt; f.data().size() &lt;&lt; " " &lt;&lt; f.data().end() - f.data().begin();
  
  }
  </code></pre>
  
  <p>the output is 60 122.</p>
  
  <p>I thought the entire vector data_ is moved over and over again, but why are begin() end() invalid after this operation?</p>