Transfers ownership of a thread of execution from one std::thread object to another std::thread
object.
thread& operator=(thread&& other);
- Effects:
If
this->joinable()would returntrueprior to the call, callsstd::terminate()to abort the program. Ifotherhas an associated thread of execution prior to the assignment, that thread of execution is now associated with*this. Otherwise*thishas no associated thread of execution.- Postconditions:
this->get_id()is equal to the value ofother.get_id()prior to the call.other.get_id()==id().- Throws:
Nothing
- Note:
std::threadobjects are notCopyAssignable, so there is no copy-assignment operator, only this move-assignment operator.
Header
#include <thread>