title: how to store pointers in map
body: <p>I am working on one of the project which requires </p>
  
  <pre><code>class MyObj;
  
  map&lt;string, MyObj*&gt; myMap;
  </code></pre>
  
  <p>Here logic is here to map file name to MyObj class.</p>
  
  <p>If I try to insert following </p>
  
  <pre><code>string strFilename = "MyFile";
  MyObj* pObj  = new MyObj();
  
  myMap.insert(strFileName, pObj); // This line throwing following error.
  </code></pre>
  
  <blockquote>
    <p>no matching function for call to <code>'std::map&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, void*, std::less&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;const std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, void*&gt; &gt; &gt;::insert(std::string&amp;, void*)'</code></p>
  </blockquote>
  
  <p>Can any one please help me how to solve this. Are is there better way we can do this using STL</p>