Gives an error indicating boost::thread

non-standard syntax; use "&" to create a pointer to member `

What needs to be fixed? If you specify stupid &readFile , another error will appear

&: invalid operation with bound member function expression

 class Service { public: void readFile() {...}; void sum() { for (int i = 0; i < 5; ++i) { threads.push_back(boost::thread(readFile)); } } private: vector<boost::thread> threads; }; 
  • and one more comment: do not use compiler message translation. So you narrow the search area at times. English-language messages will allow you to search for answers more quickly. - user1056837
  • readFile is a member function of the class . So at a minimum, you need to specify this fact ... but at most, well, you gave the address - and for what object should it be called? It also has a hidden parameter this - how does thread know what to pass to readFile ? - Harry
  • one
    @ user1056837 Well, for example, I have a VC ++ 2015 diagnostics in Russian :) So this may not be a complete translation ... - Harry

0