std::latch::latch(3)

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

πŸ’… NAME πŸ’…

Okay so bestie, welcome to the std::latch::latch(3) page from the C++ Standard Libary manual. The NAME line is std::latch::latch - std::latch::latch, and that’s the whole name vibe. πŸŽ€


🧡 Synopsis 🧡

Both of these are since C++20, periodt:

constexpr explicit latch( std::ptrdiff_t expected ); (1) (since C++20)
latch( const latch& ) = delete;                      (2) (since C++20)
  1. Builds a latch and initializes its internal counter. The behavior is undefined if expected is negative or greater than max() β€” not β€œundefined” like cute mysterious, undefined like do-not-do-it, fr fr. 😭
  2. The copy constructor is deleted. latch is neither copyable nor movable. So no duplicating, no yeeting it around by copy/move. πŸ’€

🌸 Parameters 🌸

  • expected β€” the initial value of the internal counter. That’s the starting number, bestie. ✨

🫢 Exceptions 🫢

Throws nothing. Literally nothing. Clean, quiet, lowkey iconic. πŸ’–


πŸŽ€ Friendly reminder: expected being negative or greater than max() is undefined behavior, so please don’t test the universe like that. πŸ™ˆ

Cute sign-off: source is http://cppreference.com πŸ’», version/date is 2024.06.10 πŸ“…. Mwah, slay, bye bestie. πŸ’…πŸŒˆ

πŸ“¦ where this page comes from