title: how to add to a map <int, list <int> >
body: <p>Say I have a text file like so: </p>
  
  <pre><code>1 2
  1 3
  2 7
  2 8 
  </code></pre>
  
  <p>What I would like to do is to put these in a map of linked lists. So I have initialized a map like so, <code>map &lt;int, list&lt;int&gt; &gt; myMap;</code></p>
  
  <p>My problem is that I do not know how to add this to the list. Normally, we can add to the map by just having <code>myMap[someKey] = someValue;</code>
  I'm having trouble adding a value to the list.</p>
  
  <p>What I would like is to check whether the first int that is read is in the map, if not, create that entry, and add the second int to the list that corresponds to that key. For instance, if correctly done, line 1 should have inserted a key of 1 and a linked list with the element of 2. 
  If the map already has that key, then the second int of that line should just be added to its linked list. For instance, line 2 should only be adding the element 3 to the 1's linked list.</p>
  
  <p>What I'm hoping for is this:</p>
  
  <pre><code>key : value 
  1 : 2 -&gt; 3
  2 : 7 -&gt; 8
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>ifstream infile;
  infile.open(fname.c_str());
  string line = "";
  if (infile){
      while (getline(infile, line)){
         istringstream iss(line);
         int tail;
         iss &gt;&gt; tail;
         int edges;
         if (vertices.find(tail) == vertices.end()){
             iss &gt;&gt; edges;
             vertices[tail] = vertices[tail].push_back(edges);
             //I'm getting this error: no viable overloaded '='
         }
         else{
             iss &gt;&gt; edges;
             vertices[tail].push_back(edges);
         }
      }
  }
  </code></pre>