[libcxx-commits] [PATCH] D72240: Implement C++20 std::atomic_ref and test
Olivier Giroux via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 6 07:57:23 PST 2020
__simt__ added a comment.
That's a creative use of __cxx_atomic_impl that I hadn't foreseen. Seems to work. Ok.
It would be good if we could de-duplicate code here, because we're on a trajectory of having 4+ versions of every function that differ only on the type they take. Sounds like a perfect opportunity to sprinkle some enable_if here with a helper trait to determine if the thing is a __cxx_atomic_impl, volatile __cxx_atomic_impl, __cxx_atomic_impl of reference, or volatile __cxx_atomic_impl of reference.
As for the freestanding mode (or to be more accurate, the builtin-only mode) the only option you have for atomic_ref is to static_assert that it is always lock-free. There is presently 1 platform that builds with this mode (CUDA 10.2+) and this is what we planned to do anyway.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72240/new/
https://reviews.llvm.org/D72240
More information about the libcxx-commits
mailing list