title: Vector of pairs to map
body: <p>I have a little problem.
  I have a vector of pairs patternOccurences. The pairs are <code>&lt;string,int&gt;</code>, where string is the pattern(name) and int the index where it appears. My problem is that patternOccurences has multiple pairs with the same .first(same pattern) but different int values. 
  For example: The vector has 10 entries. 5 of pattern "a" and 5 of pattern "b". all have different indices. Now i want to have a map (or something similar) so that i have a vector/list with each pattern(in my example "a" and "b") as a key and a vector of their indices as the value. The indices are in the different pairs in my vector of pairs and i want all indices for pattern "a" in a int vector as value for key "a".</p>
  
  <p>I tried the following:</p>
  
  <pre><code>std::map&lt;std::string,std::vector&lt;int&gt;&gt; occ;
      for(int i = 0;i&lt;patternOccurences.size();i++){
          if(occ.find(patternOccurences.at(i).first)==occ.end()){
              occ[patternOccurences.at(i).first]=std::vector&lt;int&gt;(patternOccurences.at(i).second);
          }
          else{
              occ[patternOccurences.at(i).first].push_back(patternOccurences.at(i).second);
          }
      }
  </code></pre>
  
  <p>patternOccurences is the vector of pairs and occ the desired map. First i check if there is already an entry for the string(pattern) and if not i create one with a vector as value. If there is already one I try to push_back the vector with the index. However it doesnt seem to be working right. For the first pattern i get a vector with 0 only as values and for the second there are only 3 indices which are right and the other ones are 0 as well.</p>
  
  <p>I hope you can help me.
  Kazoooie</p>