struct mycompare1 {
bool operator() (const Interval a, const Interval b) {
return a.start < b.start;
}
} mycompare1_instance;
static bool mycompare2(const Interval a, const Interval b) {
return a.start < b.start;
}
Q1: What is the difference between these two. It seems that mycompare1_instance somehow equals to mycompare2 like this. The following two lines seem to do the same thing.
sort(intervals.begin(), intervals.end(), mycompare1);
sort(intervals.begin(), intervals.end(), mycompare2);
Could anyone explain it?
Q2: How is "static" useful here?
Thx ahead!