title: Adding an element <string, pointer> to boost unordered hashmap
body: <p>I am using boost unordered hashmap in C++ and I am unable to add elements to my hash map (my program has a segmentation fault). I am very new to C++ and the majority of my code (except the hash map handling) is C code. Could you please point out the problem.</p>
  
  <pre><code>// my simplified code
  
  struct Record
  {
          char *data;
  
  };
  
  typedef boost::unordered_map&lt;std::string, std::vector&lt;Record*&gt; &gt; MAP;
  typedef std::pair&lt;std::string,std::vector&lt;Record*&gt; &gt; PAIR;
  
  struct OuterRelation
  {
          short num_keys;
          short join_key_ndx;
          MAP hash_table;
  };
  
  OuterRelation *outer_relation = (OuterRelation *) malloc (sizeof(OuterRelation)) ;
  
  Record *new = (Record *) malloc(sizeof(Record));
  new-&gt;data = "somestring";
  
  outer_relation-&gt;hash_table[new-&gt;data].push_back(new);
  </code></pre>
  
  <p>The problem is in the last line.</p>