With a typedef i define my fp
type as functionpointer. With AddFunc
a function can be added to the list listFunc
typedef void (*fp)();
std::list<fp> listFunc;
void AddFunc(void (*func)()) {
listFunc.emplace_back(func);
}
Now i also want to remove some functions from the list. The first time i tried it like this:
bool RemoveConnectFunc(void (*func)()) {
std::list<fp>::iterator findIt;
findIt = std::find(listFunc.begin, listFunc.end(), func); // error with 3rd argument
if (findIt != listFunc.end()) {
listFunc.erase(findIt);
}
}
but it don't works as excpected. Do i need a predicate for it?
Aucun commentaire:
Enregistrer un commentaire