I use C++ with cmake makefile with "-std=c++11".
My program use several thread method. I can build and execute my program without problem.
But when I add -03 flag on cmake option, I have this error message "no matching constructor for initialization of 'std::thread'"
First I d'ont understand why is appear only in -O3 option.
Second I would like to compile in -O3, I see others Q&A who talk about mythread = std::thread(&X::run<A, B>, this, a, b); but it doesn't work in my program and I don't understand how to use.
Here my function I want to thread:
static void getPoints(Mat *in, vector<Point> *posPoint, float *h,int rad, int dex,int decy, Mat *debug = NULL );
Today I call very simply with : std::thread t1(get4points,&myImage, ...
In case of std::thread(&X::run, this, a, b); I don't understand what is exactly &X::run, in case of I call a function of one class in a function of the same class.
Exemple pseudo code:
class myclass
{
template<int A, int B> void run(int a, int b)
{
}
void myMainfunction(int a, int b)
{
?????? -> std::thread(&this::run<int, int>, this, 1, 1);
}
};
thx for your help
Aucun commentaire:
Enregistrer un commentaire