samedi 7 septembre 2019

Sort comparator function in c++

Can anybody please explain to me that what does the below mentioned function do when passed with sort() function in c++ i.e. sort(vector.begin(), vector.end(), comparatorFunction).

Struct Job{
    string name;
    int start, end;//starting and ending time of a process in pc
};

bool arrangeTimeByStart(Job j1, Job j2){
    if(j1.end == j2.end){
        return j1.start<j2.start;
    }
    return false;
}

Aucun commentaire:

Enregistrer un commentaire