title: Why isn't the [] operator const for STL maps?
body: <p>Contrived example, for the sake of the question:</p>
  
  <pre><code>void MyClass::MyFunction( int x ) const
  {
    std::cout &lt;&lt; m_map[x] &lt;&lt; std::endl
  }
  </code></pre>
  
  <p>This won't compile, since the [] operator is non-const.  </p>
  
  <p>This is unfortunate, since the [] syntax looks very clean.  Instead, I have to do something like this:</p>
  
  <pre><code>void MyClass::MyFunction( int x ) const
  {
    MyMap iter = m_map.find(x);
    std::cout &lt;&lt; iter-&gt;second &lt;&lt; std::endl
  }
  </code></pre>
  
  <p>This has always bugged me.  Why is the [] operator non-const?</p>