title: C++ STL map: insert is storing null pointers
body: <p>I have a simple class</p>
  
  <pre><code>    class symbol_entry
  {
  private:
      static unsigned long uid;
  
  public:
      std::string name;
      std::string filename;
      unsigned int line_number;
      unsigned int column_number;
      symbol_entry* parent_symbol;
      std::map&lt;const char*,symbol_entry*&gt; child_symbols;
      unsigned long type_flags;
  
  public:
      symbol_entry();
      symbol_entry(const char* name,
                   const char* filename,
                   int line_number,
                   int column_number,
                   symbol_entry* parent_symbol,
                   unsigned long type_flags);
      ~symbol_entry();
  
      symbol_entry* get_child(const char* name);
      bool put_child(symbol_entry* child);
  };
  </code></pre>
  
  <p>here is the implementation of symbol_entry::put_child;</p>
  
  <pre><code>bool symbol_entry::put_child(symbol_entry* child)
  {   
      if(child_symbols[child-&gt;name.c_str()])
          return false;
      child_symbols.insert(std::make_pair(child-&gt;name.c_str(),child));
      return true;
  }
  </code></pre>
  
  <p>whenever i perform a test like this;</p>
  
  <pre><code>symbol_entry* tsym=new symbol_entry("test","$",0,0,0,0);
  symbol_entry* tcsym=new symbol_entry("test_child","$",0,0,0,0);
  tsym-&gt;put_child(tcsym);
  std::cout&lt;&lt;tsym-&gt;child_symbols.begin()-&gt;first&lt;&lt;" =&gt; "&lt;&lt;tsym-&gt;child_symbols.begin()-&gt;second&lt;&lt;std::endl;
  </code></pre>
  
  <p>child_symbols.begin()->second is storing a null pointer. I cannot work this out and have tried many variations including const and references with to avail.</p>