STD::STOP_CALLBACK(3)

✨ std::stop_callback< _Callback > ✨

okay bestie, welcome to the libstdc++ section of the manual, page std::stop_callback< _Callback >(3), filed under Library Functions. this one's a whole vibe: it's the little wrapper that holds onto your callback and fires it the moment somebody makes a stop request. πŸ›‘βœ¨


🌸 NAME 🌸

std::stop_callback< _Callback > β€” a wrapper for callbacks to be run when a stop request is made.

like… that's it. that's the whole job. it babysits your callback until the stop token says "we're done here", and then it runs it. no cap. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <stop_token>

πŸ’– Public Types πŸ’–

  • using callback_type

πŸ’œ Public Member Functions πŸ’œ

stop_callback (const stop_callback &)=delete
template<typename _Cb, enable_if_t< is_constructible_v< _Callback, _Cb >, int > = 0>
stop_callback (const stop_token &__token, _Cb &&__cb)
    noexcept(is_nothrow_constructible_v< _Callback, _Cb >)
stop_callback (stop_callback &&)=delete
template<typename _Cb, enable_if_t< is_constructible_v< _Callback, _Cb >, int > = 0>
stop_callback (stop_token &&__token, _Cb &&__cb)
    noexcept(is_nothrow_constructible_v< _Callback, _Cb >)
stop_callback & operator= (const stop_callback &)=delete
stop_callback & operator= (stop_callback &&)=delete
okay so real talk: the copy constructor, the move constructor, and both assignment operators are all =delete. this thing does not want to be copied, moved, or reassigned. it's giving "i'm built different and i stay put". respect it. πŸ™ˆ

πŸ¦‹ Detailed Description πŸ¦‹

template<typename _Callback>
    class std::stop_callback< _Callback >

"A wrapper for callbacks to be run when a stop request is made."

that's the tea. the class is templated on _Callback β€” your callback type β€” and it exists purely to be the middleman between a stop request and your callback. you hand it a stop_token and something constructible into _Callback, and it handles the rest. iconic behaviour honestly. πŸ‘‘

the noexcept bits on the constructors come straight from is_nothrow_constructible_v< _Callback, _Cb >, so whether these are noexcept depends entirely on whether your callback can be built from _Cb without throwing. and the enable_if_t< is_constructible_v< _Callback, _Cb >, int > = 0 is the bouncer at the door β€” if _Callback isn't constructible from _Cb, you're not getting in. πŸ’…


⭐ Author ⭐

Generated automatically by Doxygen for libstdc++ from the source code.


that's the whole page, bestie. shoutout to the libstdc++ crew and to Doxygen for auto-generating this from the source code β€” this page rolled out with the libstdc++ manual and the <rainbow>std::stop_callback< _Callback >(3)</rainbow> header up top, and ngl there's no date stamped on this one, so we're running it date-less. πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from
  • centos-stream 10: gcc-toolset-15-libstdc++-docs 15.2.1-8.1.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • centos-stream 10: libstdc++-docs 14.4.1-4.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 43: libstdc++-docs 15.2.1-2.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 43: libstdc++-docs 15.3.1-1.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms