I have the following definitions and prototypes (which are member functions of a class) with which I basically try to use function pointers to pass a different type of strategy to the divideQuery method:
typedef vector<ConstraintManager> (*strategyType1)(const Query&);
typedef vector<ConstraintManager> (*strategyType2)(const Query&, int);
vector<ConstraintManager> divideQuery (strategyType1 s, const Query& query);
vector<ConstraintManager> divideQuery (strategyType2 s, const Query& query, int parts);
vector<ConstraintManager> divideByHalf(const Query& query);
vector<ConstraintManager> divideRandom(const Query& query);
vector<ConstraintManager> divideByN(const Query& query, int n);
However when I try to call (query parameter is passed from the wrapping function):
vector<ConstraintManager> result = divideQuery(divideRandom, query);
It fails with the error message:
DividingSolver.cpp:200:70: error: no matching function for call to ‘DividingSolver::divideQuery(<unresolved overloaded function type>, const klee::Query&)’
DividingSolver.cpp:82:27: note: candidates are: std::vector<klee::ConstraintManager> DividingSolver::divideQuery(std::vector<klee::ConstraintManager> (*)(const klee::Query&), const klee::Query&)
DividingSolver.cpp:87:27: note: std::vector<klee::ConstraintManager> DividingSolver::divideQuery(std::vector<klee::ConstraintManager> (*)(const klee::Query&, int), const klee::Query&, int)
As far as I read from the web it seems like an overloading error (or maybe something else) but in any case I am not quite sure what exactly is wrong. Any hints/explanations is appreciated.
Cheers
divideRandomfunctions (that is, the namedivideRandomwas overloaded). Are you sure that you only have one implementation?#include <vector> using std::vector; struct Query {} query; struct ConstraintManager {};and it compiled for me. (gcc 4.7.?)divideXXXmember functions of a class?