Vote count:
0
I have the following function:
CompareType CompareByCitizensNum(const City& c1, const City& c2) {
if (c1.getNumCitizens() > c2.getNumCitizens()
|| ((c1.getNumCitizens() == c2.getNumCitizens())
&& (c1.getCityId() > c2.getCityId()))) {
return BIGGER;
} else if (c1.getCityId() == c2.getCityId()) {
return EQUALS;
}
return SMALLER;
}
and this is the method that needs to use this function:
avlTreeVertix(City newKey, avlTreeVertix* fatherToBe,
CompareType (*compare)(const City&, const City&)) :
bf(0), key(newKey), RightHigh(0), LeftHigh(0), vertexesInSubTree(1), father(
fatherToBe), childL(NULL), childR(
NULL), compare(compare) {
CHECK_NULL(father,);
if (compare(key, father->key) == BIGGER) {
//if (isGreater(father)) {
father->childR = this;
} else {
father->childL = this;
}
}
I tried to call it by the following line:
rankTree = new avlTreeVertix(c, NULL, CompareByCitizensNumx);
But it says: no matching function for call to 'wet2::avlTreeVertix::avlTreeVertix(wet2::City&, NULL, )'
Any ideas? Thanks!
asked 9 secs ago
function as a parameter to another function error - c++
Aucun commentaire:
Enregistrer un commentaire