Function pointer : 'function does not evaluate to a function which takes 2 arguments'
Hey guys ! I have an error that I can't get rid of. It's 'function does not evaluate to a function which takes 2 arguments'. I have tried modifying cmp_func to (*cmp_func) and (&cmp_func) but neither was the solution.
Here's the (shortened) code.
Code:
class CoursMgr
{
public:
private:
typedef bool (CoursMgr::*CMP_FUNC)(int, int);
// Gros HACK pas beau..
bool FONCTION_NULLE(int, int) { }
};
Code:
if(cmp_func == FONCTION_NULLE)
if(ComparePPE(trav_it->NoteObtenue, a + b) && ComparePGE(trav_it->NoteObtenue, a - b))
ls_resultat.back().Travaux.push_back(*trav_it);
else
if(cmp_func(trav_it->NoteObtenue, donnee))
ls_resultat.back().Travaux.push_back(*trav_it);
What's weird is that cmp_func can only be a pointer to ComparePPE, ComparePGE and another function, yet the code in blue compiles but not the code in red.
Any help will be much appreciated.