Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your compare function is broken. also please use std::sort, not the c-style qsort.

int compare(const Rect &a, const Rect &b) {
    return a.x - b.x;
}

std::sort(vec.begin(), vec.end(), compare);