title: alias used not modifying the actual contents of STL container
body: <p>I am unable to understand the following behaviour. When I use <code>currPMap</code> to modify the value, the value at the actual location is not modified. Why is that so.</p>
  
  <p>I checked with the reference the <code>operator[]</code> and <code>at()</code> return reference and so this should have worked.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;map&gt;
  
  using namespace std;
  
  typedef map&lt;int, int&gt; intMap;
  typedef map&lt;int, int&gt;::iterator mapIt;
  
  int main(void) {
      vector&lt; map&lt;int, intMap &gt; &gt; b(2);
      int curr=0, next=1;
      map&lt;int, intMap&gt; currPMap = b.at(curr);
      (currPMap[4])[2] = 3;    //modified by currPMap.
      cout&lt;&lt;((b.at(curr))[4])[2]&lt;&lt;endl;
      ((b.at(curr))[4])[2] = 3;    //modified using the actual vector.
      cout&lt;&lt;((b.at(curr))[4])[2]&lt;&lt;endl;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>0
  3
  </code></pre>
  
  <p>P.S.: I know what I am doing here can be achieved by many other ways in this setting, but this is not the actual program. This is just the explicit version of the problem that I am facing with my code. I would be grateful if someone answers what is wrong in this method.</p>