title: Why is dereferenced element in const vector of int pointers mutable?
body: <p>I am not sure the true meaning of <code>const vector&lt;int *&gt;</code> so I compiled the code below to get an idea but am now more confused.</p>
  
  <pre><code>vector&lt;int *&gt; v;
  int x = 1, y = 2;
  v.push_back(&amp;x);
  v.push_back(&amp;y);
  
  const vector&lt;int *&gt; w = v;
  w[0] = &amp;y;   //failed. Element is a constant pointer?
  *(w[0]) ++;  //failed. Element pointer references to constant value?
  </code></pre>
  
  <p>If I had stopped here, I would have assumed that <code>const vector&lt;int *&gt;</code> is a vector of <code>const int * const</code>, but then I tried the following which clearly contradicted that assumption.</p>
  
  <pre><code>*(w[0]) += 3; //passed. Value not constant?
  *(w[0]) = 20; //passed. Why...
  </code></pre>
  
  <p>Now <code>*(w[0])</code> for reason unknown to me obviously treats <code>++</code> and <code>+=</code> and assignment differently. I convinced myself that <code>const vector</code> only declares a constant object of the <code>vector</code> class and that the above results might depend on the actual implementation of the operator overloading of <code>vector</code> class. But I can't wrap my head around this. Can anyone help explain, please?</p>
  
  <p>If it is relevant, I used g++ 4.2 on a Mac.</p>