title: c++ two versions of overloading subscript operator
body: <p>My question is about the difference between:</p>
  
  <pre><code>const T&amp; operator[](const int nIndex) const;
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>T&amp; operator[](const int nIndex);
  </code></pre>
  
  <p>Why would I need both of them defined in a class, what's the purpose? Wouldn't the latter suffice?</p>