title: Writing a scanline algorithm for filling triangles in c++
body: <p>I am attempting to write a a function that takes in a vector of coordinates describing the outline of a triangle and returns a vector of pairs reperesenting lines used to fill the triangle described by the points</p>
  <pre><code>std::vector&lt;std::pair&lt;std::pair&lt;int, int&gt;, std::pair&lt;int, int&gt;&gt;&gt; 
  SoftwareRendererImp::scanline(std::vector&lt;std::pair&lt;float, float&gt;&gt; points)
  {
  
  std::vector&lt;std::pair&lt;std::pair&lt;int, int&gt;, std::pair&lt;int, int&gt;&gt;&gt; lines;
  // sort by y
  std::sort(points.begin(), points.end(), [](auto &amp;left, auto &amp;right)
            { return left.second &lt; right.second; });
  
  //iterate through the sorted list and do some logic to determine scan lines
  
  return lines;
  }
  </code></pre>
  <p>I have taken a few swings at trying to get this to work however I cannot seem to come up with a solid solution. I am quite rusty at c/c++ so I could be fumbling around with the language or I may be misunderstanding how this kind of algorithim is supposed to work.</p>
  <p>If this seems trivial to anyone please point mein the right direction. Thanks !</p>