quelqu'un peut me dire s'il vous plaît nous pouvons transmettre une variable boost :: thread. boost :: fil t (fil); commence un fil, mais je veux le déclarer quelque part et le démarrer ailleurs. Merci d'avance.forward déclaration de boost :: thread variable
Lorsque j'utilise
boost::thread t;
t=boost::thread (thread);
/usr/include/boost/noncopyable.hpp: In copy constructor ‘boost::thread::thread(const boost::thread&)’:
/usr/include/boost/noncopyable.hpp:27: error: ‘boost::noncopyable_::noncopyable::noncopyable(const boost::noncopyable_::noncopyable&)’ is private
/usr/include/boost/thread/thread.hpp:35: error: within this context
thr.cpp: In function ‘int main()’:
thr.cpp:20: note: synthesized method ‘boost::thread::thread(const boost::thread&)’ first required here
/usr/include/boost/noncopyable.hpp: In member function ‘boost::thread& boost::thread::operator=(const boost::thread&)’:
/usr/include/boost/noncopyable.hpp:28: error: ‘const boost::noncopyable_::noncopyable& boost::noncopyable_::noncopyable::operator=(const boost::noncopyable_::noncopyable&)’ is private
/usr/include/boost/thread/thread.hpp:35: error: within this context
thr.cpp: In function ‘int main()’:
thr.cpp:20: note: synthesized method ‘boost::thread& boost::thread::operator=(const boost::thread&)’ first required here
comment il est différent de votre_fonction (comme vous l'avez écrit avant d'éditer) – Shweta
@Shweta, un callable peut également être une instance d'une classe dont 'operator()' a été surchargé (parfois appelé un [objet fonction] (http: // fr .wikipedia.org/wiki/Function_object # In_C_et_C.2B.2B)). J'ai fait ce changement pour l'exhaustivité :) –
désolé ne fonctionne pas – Shweta