JohnTargaryen / Learning-C-

1 stars 0 forks source link

std::sort #5

Open JohnTargaryen opened 7 years ago

JohnTargaryen commented 7 years ago

bool COMfunction(int i, int j) {
return i < j;
} // function used for comparison 

struct COMstruct {
bool operator() (int i, int j) {
return i < j;
}
} COMobject; // object usd for comparison 

sort(iterator1, iterator2, funcionORobject); // use the rule set by compare function or object to sort a container from it1 to it2;