This code cannot be rewritten using only boolean operators. My mistake was writing
bool less_than(const pair &p1, const pair &p2)
if(p1.first == p2.first)
return p1.second < p2.second;
return p1.first < p2.first;
This does not work! Analogous combination with && also doesn't work. It could be rewritten to use the ?: operator, but with doubtful benefits. Note to self: don't try being too smart again!
(p1.first < p2.first) ||
(p1.second < p2.second);