std::atomic...s_lock_free(3)

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

πŸ’… NAME πŸ’…

okay so bestie, we're in the C++ Standard Libary manual πŸ’– and the NAME is std::atomic::is_always_lock_free - std::atomic::is_always_lock_free (yes, literally twice, we stan a repetitive queen πŸ’…).

✨ Synopsis ✨

This one is since C++17 ✨ Here's the whole static constant vibe:

static constexpr bool is_always_lock_free =
/*implementation-defined*/;

It equals true if this atomic type is always lock-free and false if it is never or sometimes lock-free. No cap.

The value of this constant is consistent with both the macro ATOMIC_xxx_LOCK_FREE, where defined, with the member function is_lock_free and non-member function std::atomic_is_lock_free.

🧠 Notes 🧠

There is no non-member function equivalent of this static member constant because non-member functions take pointers to atomic types, and therefore aren't as useful in constant expressions. That's the whole reason, bestie β€” no mystery 🫢.

Feature-test macro tea β˜•:

  • Feature-test macro: __cpp_lib_atomic_is_always_lock_free
  • Value: 201603L
  • Std: (C++17)
  • Feature: constexpr atomic<T>::is_always_lock_free

πŸ‘€ See also πŸ‘€

  • is_lock_free β€” checks if the atomic object is lock-free (public member function)
  • atomic_is_lock_free β€” checks if the atomic type's operations are lock-free (C++11) (function template)

mwah πŸ’‹ β€” this cutie came from http://cppreference.com, dated 2024.06.10.

πŸ“¦ where this page comes from