title: How to avoid const cast for map access?
body: <p>I have the following issue:</p>
  
  <pre><code>std::map&lt;A*,double&gt; map;
  
  void getColor(A const * obj){
      double d = map[obj]; // does not compile wihtout const_cast&lt;A*&gt;(obj)
      // do something
  }
  </code></pre>
  
  <p>I have a map <code>std::map</code> (somewhere) which stores pointers to objects <code>A</code>.
  I have a function <code>getColor</code> which <strong>does not</strong> manipulate objects <code>A</code>  and so takes a pointer to a  <code>const A</code> as input.</p>
  
  <p>The function <code>getColor</code> will not compile without using a const_cast.</p>
  
  <p>The const cast is a design issue, but I don't know how to circumvent it if I <strong>don't want</strong> to make the keys in <code>map</code> <strong>const</strong>.</p>
  
  <p>Any help appreciated.</p>