title: Count occurrences in vector of pairs
body: <p>I want to count the occurrences of same Points in a vector of pairs.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>vector&lt;Point2f&gt; points_1, points_2;
  
  points_1.push_back(Point2f(1.0, 2.0));
  points_1.push_back(Point2f(2.0, 2.0));
  points_1.push_back(Point2f(3.0, 2.0));
  points_1.push_back(Point2f(1.0, 2.0));
  points_1.push_back(Point2f(2.0, 2.0));
  points_1.push_back(Point2f(3.0, 2.0));
  points_1.push_back(Point2f(1.0, 2.0));
  
  points_2.push_back(Point2f(1.0, 1.0));
  points_2.push_back(Point2f(1.0, 1.0));
  points_2.push_back(Point2f(1.0, 2.0));
  points_2.push_back(Point2f(1.0, 1.0));
  points_2.push_back(Point2f(1.0, 1.0));
  points_2.push_back(Point2f(1.0, 1.0));
  points_2.push_back(Point2f(1.0, 1.0));
  
  vector&lt;pair&lt;Point2f, Point2f&gt;&gt; point_pairs;
  for (size_t i = 0; i &lt; points_1.size(); i++) {
      cout &lt;&lt; points_1[i] &lt;&lt; " " &lt;&lt; points_2[i] &lt;&lt; endl;
      point_pairs.push_back(make_pair(points_1[i], points_2[i]));
  }
  </code></pre>
  
  <p>The result should be:</p>
  
  <pre><code>[1, 2] [1, 1] - 3 Occurrences
  [2, 2] [1, 1] - 2 Occurrences
  [3, 2] [1, 2] - 1 Occurrence
  [3, 2] [1, 1] - 1 Occurrence
  </code></pre>
  
  <p>I know you can use a map with a key (like a histogram) that tracks the occurrences and I tried something like:</p>
  
  <pre><code>map&lt;pair&lt;Point2f, Point2f&gt;, int&gt; pairToCount;
  </code></pre>
  
  <p>But I am not an expert at C++ lambda and don't know how to use this pairToCount</p>