title: How to keep track of visited points in C++
body: <p>I am doing a problem in c++ that has to keep track of points that are visited in a traversal.  The point is basically, </p>
  
  <pre><code>struct Point {
    int x;
    int y;
  };
  </code></pre>
  
  <p>My first thought to solving something like this would be to use something like </p>
  
  <pre><code>std::set&lt;Point&gt; visited_points;
  </code></pre>
  
  <p>or maybe</p>
  
  <pre><code>std::map&lt;Point, bool&gt; visited_points;
  </code></pre>
  
  <p>However, I am a beginner in c++, and I realized you have to implement a Compare, which I didn't know how to do.  When I asked, I was told said that using a map was "overkill" in a problem like this.  He said the better solution was to do something like </p>
  
  <pre><code>std::vector&lt;std::vector&lt;bool&gt;&gt; visited_points;
  </code></pre>
  
  <p>He said <code>std::map</code> was not the best solution, since using a vector was faster.   </p>
  
  <p>I'm wondering why using a double vector is better in terms of style and performance.  Is it because implementing a Compare is hard for a Point?  A double vector feels hacky to me, and I also think it looks uglier than using a set or map.  Is it really the best way to approach this problem, or is there a better solution I don't know about?</p>