sundeepblue
3/31/2014 - 7:44 PM

functor

functor

struct S {
    int x, y;    
};

struct Comparator {
    bool operator() (const S& s1, const S& s2) {
        return s1.x < s2.x;
    }  
};

int main() {
    S arr[100];
    std::sort(arr, arr+100, Comparator());
}