std::thread::operator=(3)
π std::thread::operator= β C++ Standard Library, manual page std::thread::operator=(3) π
okay bestie, welcome to the std::thread::operator=(3) page β yes, the move-assignment operator for std::thread, and itβs giving βI have very specific rules and one of them is std::terminate()β energy. π
π NAME π
std::thread::operator= β literally std::thread::operator=. Thatβs the name, no notes. π
β¨ Synopsis β¨
thread& operator=( thread&& other ) noexcept; (since C++11)
If *this still has an associated running thread (i.e. joinable() == true), it calls std::terminate(). Otherwise, it assigns the state of other to *this and sets other to a default constructed state.
After this call, this->get_id() is equal to the value of other.get_id() prior to the call, and other no longer represents a thread of execution. fr fr, thatβs the whole glow-up. β¨
π¨ warning bestie: if*thisis still joinable, this operator callsstd::terminate(). That is not a drill, that is the dramatic part. π
π«Ά Parameters π«Ά
otherβ another thread object to assign to this thread object. basically the thread object getting moved into*this, slay. π¦
π Return value π
*thisβ it returns*this. main character return, no cap. π
sign-off: this page came from http://cppreference.com, dated 2024.06.10, and itβs the std::thread::operator=(3) manual page. mwah, stay joinable-safe, bestie ππΈ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms