title: c++ vector object address and data address confusion
body: <p>I created a vector <strong>a</strong> and tried to display <strong>&amp;a</strong> and <strong>&amp;a[0]</strong>.The addresses are very different. Isn't object address usually the same as first element address? And Isn't the object memory contiguous? And I noticed the address difference between <strong>&amp;a+1</strong> and <strong>&amp;a</strong> is exactly the same size of the whole vector elements, 12 bytes in this case. It looks like a copy of the whole vector to me.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main(){
  
      vector&lt;int&gt; a ={3,5,8};
      cout&lt;&lt;"vector object address: "&lt;&lt;&amp;a&lt;&lt;endl;
      cout&lt;&lt;"vector object address +1: "&lt;&lt;&amp;a+1&lt;&lt;endl;
      cout&lt;&lt;"vector data[0] address: "&lt;&lt;&amp;a[0]&lt;&lt;endl;
      cout&lt;&lt;"vector data[1] address: "&lt;&lt;&amp;a[1]&lt;&lt;endl;
  
  
      return 0;
  
  }
  </code></pre>
  
  <p>Can anyone explain to me how vector object works? Below is the code output:</p>
  
  <pre><code>vector object address: 0034FEBC
  vector object address +1: 0034FEC8
  vector data[0] address: 007D8208
  vector data[1] address: 007D820C
  </code></pre>