Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

if you got a vector<Rect>, you can use std::sort, all you need is a compare function:

bool compare_rect(const Rect & a, const Rect &b) {
    return a.x < b.x;
}

vector<Rect> rects;
sort( rects.begin(), rects.end(), compare_rect );