class StringListCompare
{
public:
explicit StringListCompare(int column, int column2) : m_column(column), m_column2(column2) {}
booloperator()(const vector<string>& lhs, const vector<string>& rhs)
{
if (lhs[m_column] == rhs[m_column])
{
return lhs[m_column2] < rhs[m_column2];
}
else
{
return lhs[m_column] > rhs[m_column];
}
}
private:
int m_column;
int m_column2;
};
Now I want to extend this 2 column level sort to unlimited column level sort. So I changed this code as given below. But I don't What logic I missing here.