multithreading - Invalid use of non-static member function in threads c++ -


i got stuck passing class member functions threads. i've searched web, , found different variants, nothing worked. here code:

void generate(){     std::vector<std::thread> threads;     for(size_t i=0; i<10; i++){         threads.push_back(std::thread(move_column_blocks, 1, 2));         threads.push_back(std::thread(move_column_blocks, 2, 3));     }      for(auto& t : threads)         t.join(); } 

the error

invalid use of non-static member function

 threads.push_back(std::thread(move_column_blocks, 1, 2)); 

p.s. i've tried one: std::thread(&classname::move_column_blocks, this, 1, 2) - did not work


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -