c++ - How to use pointer to member function when when pointer to global function is required? -


I have the following problem: I have to use a function that takes a callback, implementing a callback is a difficult part because I More information is required, except that I can extract from the input parameter. I will try to give an example:

  typingf (* FTP) (four * in, four * out); // Callback I have to apply int letterer (FTPR, four * some other parameters); // is to use the method  

The problem is that I need additional information except the "in" parameter to create the "out" parameter I tried this approach: < / P>

  class wrapper {public: int callback (char * in, char * out) {// "extra info" to create "outIn") char * additionalInfo; } ... wrapper * obj = new wrapper (); Obj- & gt; Additional INFO = "whatIneed"; Lefter (obj-> callback, some peacock paragraphs);  

I get the following error from the compiler:

Error: 'Cover': Callback type 'can not be changed with type' (ripper: :) Type four * * 'fptr {aka int * (* four *, four *)}'

You need to pass which you need to pass, in this case, an indicator in any function.

  :: std :: function & lt; Int (char *, four *)> Forwardcall; Int mycallback (char * in, char * out) // extern "C" {forward forward (in, out); For example:  
  forwardcall = [obj] (four *, four * *)  

out ) {Back to obj-> Callback (in, out); };


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -