c++ - Function Pointer Overloading Error? -


I have the following definitions and prototypes (which are members of a class function) with which I basically use Function Pointer I try to do a different type of strategy for differential method:

  typingfifferent vector & lt; ConstrainManager & gt; (* Strategy Type 1) (Const Query & amp;); Typingf vector & lt; ConstrainManager & gt; (* Strategy Type 2) (Const Query & Int); Of vector & lt; ConstraintManager & gt; Dividequery (strategy type 1s, consort query and query); Of vector & lt; ConstraintManager & gt; Dividequiry (strategy type 2 s, consort query and query, int parts); Of vector & lt; ConstraintManager & gt; DivideByHalf (Constant Query and Query); Of vector & lt; ConstraintManager & gt; Split-random (query query and query); Of vector & lt; ConstraintManager & gt; DivideByN (Const Query and Query, Int N);   

However, when I try to call (the query parameter passed by the wrapping function):

  Vector & lt; ConstrainManager & gt; Result = partition (divideRandom, query);   

This fails with the error message:

  DividingSolver.cpp: 200: 70: Error: No matching calls to call Function ???? DividingSolver :: DivideActary (& lt; Unsolved Loaded Function Type; Cons Clay :: Quiz & amp; DividingSolver.cpp: 82: 27: Note: Candidates are: std :: vector & lt; Klee :: Constrainmanager & gt; DividingSolver :: divideQuery (std :: vector & lt; klee :: ConstraintManager & gt; (*) (Constant Clay :: Quir & amp; amp;;), Const Clay :: Quiver and Diving Solver CPP: 87: 27: Note: std :: vector & lt; klee :: ConstraintManager & gt; DividingSolver :: divideQuery (std :: vector & lt; klee :: ConstraintManager & gt; (*) (Const Clay :: Query and Int), Const Clay :: Choir As far as I read from the web, it looks like an overloading error (or maybe some more), but in any situation I am not sure. Is that No sign / clarification is appreciated.  

Cheers

< P> The problem is that there is no non-static member function in the same signature as a free function, especially hidden in this indicator that you have now Which is a call on divideQuery , where the first argument is an indicator for the member function, but there is no overload, which indicates the member function , So the compiler gets out with an error message.

If the functions do not use the state from the square, you can make them stable , which will remove the underlying this and it should work Another option is actually using the pointers in the divideQuery interface. The third option will use the construction of high level for the argument, such as std :: function & lt; & Gt; std :: bind (or boost :: function ) and then this to bind the argument ( boost :: bind ).

Comments