title: Using char* as a key in std::map
body: <p>I am trying to figure out why the following code is not working, and I am assuming it is an issue with using char* as the key type, however I am not sure how I can resolve it or why it is occuring. All of the other functions I use (in the HL2 SDK) use <code>char*</code> so using <code>std::string</code> is going to cause a lot of unnecessary complications.</p>
  
  <pre><code>std::map&lt;char*, int&gt; g_PlayerNames;
  
  int PlayerManager::CreateFakePlayer()
  {
      FakePlayer *player = new FakePlayer();
      int index = g_FakePlayers.AddToTail(player);
  
      bool foundName = false;
  
      // Iterate through Player Names and find an Unused one
      for(std::map&lt;char*,int&gt;::iterator it = g_PlayerNames.begin(); it != g_PlayerNames.end(); ++it)
      {
          if(it-&gt;second == NAME_AVAILABLE)
          {
              // We found an Available Name. Mark as Unavailable and move it to the end of the list
              foundName = true;
              g_FakePlayers.Element(index)-&gt;name = it-&gt;first;
  
              g_PlayerNames.insert(std::pair&lt;char*, int&gt;(it-&gt;first, NAME_UNAVAILABLE));
              g_PlayerNames.erase(it); // Remove name since we added it to the end of the list
  
              break;
          }
      }
  
      // If we can't find a usable name, just user 'player'
      if(!foundName)
      {
          g_FakePlayers.Element(index)-&gt;name = "player";
      }
  
      g_FakePlayers.Element(index)-&gt;connectTime = time(NULL);
      g_FakePlayers.Element(index)-&gt;score = 0;
  
      return index;
  }
  </code></pre>