std::stop_token::operator=(3)

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

πŸŽ€ NAME πŸŽ€

std::stop_token::operator= β€” the assignment operator for std::stop_token, and this is the std::stop_token::operator=(3) page from the C++ Standard Libary manual. yes, that spelling is the page's, not mine πŸ’€.

✨ Synopsis ✨

std::stop_token& operator=( const std::stop_token& other ) noexcept;

(1) (since C++20)

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

(2) (since C++20)

okay so this operator replaces the associated stop-state with that of other. both overloads are noexcept, and both have been around since C++20. no cap. 🫢

  1. Copy assignment (1) β€” copy-assigns the associated stop-state of other to that of *this. Equivalent to stop_token(other).swap(*this). it's giving "share the stop-state" energy, and it's noexcept. πŸ’…
  2. Move assignment (2) β€” move-assigns the associated stop-state of other to that of *this. After the assignment, *this contains the previous associated stop-state of other, and other has no associated stop-state. Equivalent to stop_token(std::move(other)).swap(*this). also noexcept, also iconic. πŸ”₯

🌸 Parameters 🌸

  • other β€” another std::stop_token object to share the stop-state with, or to acquire the stop-state from. πŸŽ€

mwah πŸ’‹ source: cppreference.com Β· version/date: 2024.06.10 Β· page: std::stop_token::operator=(3). stay hydrated and go be a main character with your stop tokens, bestie 🫢🌈

πŸ“¦ where this page comes from