[libcxx-commits] [libcxx] [libcxx] Implementation of P1831R1 (PR #101439)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 1 19:47:43 PDT 2024
================
@@ -74,7 +74,7 @@ struct atomic<_Tp*> : public __atomic_base<_Tp*> {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {}
_LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __d) volatile _NOEXCEPT
- requires __base::is_always_lock_free
+ _LIBCPP_REQUIRE_IS_ALWAYS_LOCK_FREE
----------------
frederick-vs-ja wrote:
> since virtually all systems with atomic instructions will support atomic reads and writes of pointer width
This is not guaranteed/required by the standard.
I think the approach in microsoft/STL#634 works - define a conditionally deprecated but always `true` constant and then `static_assert` it. With this approach you don't need to be worried about whether some atomic types are always lock-free.
https://github.com/llvm/llvm-project/pull/101439
More information about the libcxx-commits
mailing list