I changed it to a typedef, although I think that, e.g., 

    const double m = (q.y - p.y) / (q.x - p.x);

would be semantically clearer than

    const double m = (q.second- p.second) / (q.first - p.first);