title: Sort 2D vector by Multiple columns
body: <p>I'm using the following boost algorithm to sort my 2D vector.</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;boost/algorithm/string.hpp&gt;
  
  using namespace std;
  
  
  class StringListCompare
  {
  public:
    explicit StringListCompare(int column) : m_column(column) {}
    bool operator()(const vector&lt;string&gt;&amp; lhs, const vector&lt;string&gt;&amp; rhs)
    {
      // what do we do if lhs or rhs don't have (m_column + 1) elements?
      return lhs[m_column] &lt; rhs[m_column];
    }
  private:
    int m_column;
  };
  
  int main()
  {
    std::vector &lt;std::vector &lt;std::string&gt; &gt; data;
    std::vector &lt;std::string&gt; temp;
    //
    // Load 2D vector 
    sort(data.begin(), data.end(), StringListCompare(2));
  
    //Print 2D vector after sorting by 2nd column
  }
  </code></pre>
  
  <p>Here I can sort the vector by Only one column which i specified as argument. But I want to sort this vector by two columns. My first column should be in sorted. According the first column sort I want to sort the vector again by 2nd column. 
  How can i do this ? </p>
  
  <p>I want to sort first by the first column, and then sort the ones with equal first column to be sorted by the second column?</p>