std::jthread::operator=(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::jthread::operator=(3) πŸ’–

okay so this is the page for std::jthread::operator= from the C++ Standard Libary manual, and it’s giving very specific move-assignment energy. 🫢✨


✨ NAME ✨

std::jthread::operator= β€” literally std::jthread::operator=. No cap, that’s the name. πŸ’…

🌈 Synopsis 🌈

std::jthread& operator=( std::jthread&& other ) noexcept;

(since C++20) πŸ¦‹

If *this still has an associated running thread (i.e. joinable() == true), it calls request_stop() followed by join(). Then 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 the associated stop-state is also moved. Also, other no longer represents a thread of execution nor has any stop-state. Periodt. πŸ’€βœ¨

πŸŽ€ Parameters πŸŽ€

  • other β€” another jthread object to assign to this jthread object. That’s the whole assignment vibe, bestie. πŸ¦‹

πŸ‘‘ Return value πŸ‘‘

It hands you back *this. That’s it, that’s the return value. πŸ’–


This page came from http://cppreference.com, version 2024.06.10, and it’s std::jthread::operator=(3) β€” mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from