std::barrier::barrier(3)
π std::barrier::barrier(3) π
okay so weβre in the C++ Standard Libary manual, section 3, and this page is literally all about std::barrier::barrier. Bestie, itβs giving constructor lore, and we are keeping every single detail, fr fr. β¨
πΈ NAME πΈ
std::barrier::barrier β and yes, the name line is std::barrier::barrier - std::barrier::barrier. No cap, thatβs the whole vibe. π
β¨ Synopsis β¨
Hereβs the synopsis, bestie:
(1) (since C++20)
constexpr explicit barrier( std::ptrdiff_t expected,
CompletionFunction f = CompletionFunction());
(2) (since C++20)
barrier( const barrier& ) = delete;
- Constructor (1) sets both the initial expected count for each phase and the current expected count for the first phase to
expected. It initializes the completion function object withstd::move(f), and then starts the first phase. The behavior is undefined ifexpectedis negative or greater thanmax(). π - Constructor (2) is the copy constructor, and it is deleted.
barrieris neither copyable nor movable. Periodt. π«Ά
π Parameters π
expectedβ initial value of the expected count. πfβ completion function object to be called on phase completion step. π
π₯ Exceptions π₯
- Constructor (1) can throw any exception thrown by
CompletionFunction's move constructor. π
π¦ Notes π¦
expected is permitted to be zero. However, calling any non-static member function other than the destructor on such barrier results in undefined behavior. In other words, such barrier can only be destroyed. π
β οΈ Warning, bestie: zero is allowed, but a zero-expected barrier is basically βlook, donβt touchβ β only the destructor is safe. No cap. π
source/version/date check: http://cppreference.com β’ 2024.06.10 β’ std::barrier::barrier(3) slay and goodbye πβ¨
π¦ 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