I am trying to pass a member function to QtConcurrent::run()
I have tried to do it like so:
GDALDriver *poNITFDriver;
future = QtConcurrent::run(poNITFDriver,&GDALDriver::CreateCopy, pszDstFilename, poDataset, FALSE, papszOptions, pfnProgress, NULL);
but I get a slew of errors regarding no matching function call.
This was the original call:
poNITFDriver->CreateCopy(pszDstFilename, poDataset, FALSE, papszOptions, pfnProgress, NULL);
What am I doing wrong? Can run() accept that many arguments?
This is the error I get:
error: no matching function for call to run(GDALDriver*&, GDALDataset* (GDALDriver::*)(const char*, GDALDataset*, int, char**, int (*)(double, const char*, void*), void*), const char**, GDALDataset**, bool, char***, int (**)(double, const char*, void*), NULL)
Thanks
You will have to pass a pointer of the object as the first argument and the address of the method as the second argument (then follow it by any other arguments).
Have a look at this documentation. Have a look at the sections:
Specifically, you can use
boost::bind()orstd::tr1::bind()to bind a number of arguments to a function when called. There are number of reasons for doing this:I think you have more than 5 parameters being passed there.