title: How to insert into std::map
body: <p>In code below:</p>
  
  <pre><code>map&lt;string,vector&lt;int&gt;&gt; create(ifstream&amp; in, const vector&lt;string&gt;&amp; vec)
  {
      /*holds string and line numbers into which each string appears*/
      typedef map&lt;string,vector&lt;int&gt;&gt; myMap;
      typedef vector&lt;string&gt;::const_iterator const_iter;
  
      myMap result;
      string tmp;
      unsigned int lineCounter = 0;
  
      while(std::getline(in,tmp))
      {
          const_iter beg = vec.begin();
          const_iter end = vec.end();
  
          while (beg &lt; end)
          {
              if ( tmp.find(*beg) != string::npos)
              {   
                  result[*beg].push_back(lineCounter);//THIS IS THE LINE I'M ASKING FOR
              }
              ++beg;
          }
  
          ++lineCounter;
      }
  
      return result;
  }
  </code></pre>
  
  <p>How should I do it (check line commented in code) if I want to use insert method of map instead of using operator[]?<br>
  Thank you.</p>