title: Calling map::find with a const argument
body: <p>I have an object:</p>
  
  <pre><code>map&lt;A*, string&gt; collection;
  </code></pre>
  
  <p>I would like to call the map::find function, but the value I have for the key is const, like in the following code, which does not compile:</p>
  
  <pre><code>const A* a = whatever();
  collection.find(a);
  </code></pre>
  
  <p>The following code works and performs the equivalent of the find operation:</p>
  
  <pre><code>const A* a = whatever();
  map&lt;A*, string&gt;::iterator iter;
  for(iter = collection.begin(); iter != collection.end(); ++iter)
      if(iter-&gt;first == a)
          break;
  // iter now contains the result or map::end (just like map::find)
  </code></pre>
  
  <p>But it is probably not as efficient as the find member function, and it's also ugly and masks the intent of the code.</p>
  
  <p>How can I call the find function?</p>
  
  <p>Thanks</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I am intentionally using a pointer type for the key in the map. The behaviour I want is for the map to use pointer equality for the keys. (Just like in my loop code)</p>