[libcxx-commits] [libcxx] 0529025 - [libc++] Use this in lamba capture in <latch>
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 4 11:44:00 PDT 2023
Author: Edoardo Sanguineti
Date: 2023-07-04T20:43:56+02:00
New Revision: 0529025648b5e119ea75a06c6819d0f135efe0eb
URL: https://github.com/llvm/llvm-project/commit/0529025648b5e119ea75a06c6819d0f135efe0eb
DIFF: https://github.com/llvm/llvm-project/commit/0529025648b5e119ea75a06c6819d0f135efe0eb.diff
LOG: [libc++] Use this in lamba capture in <latch>
"&" seemed to be used in a situation where perhaps it's not the best option.
Other libc++ modules make use of [this] when calling functions from the same class.
[this] would be the appropriate lambda capture specifier to use in this situation.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D154358
Added:
Modified:
libcxx/include/latch
Removed:
################################################################################
diff --git a/libcxx/include/latch b/libcxx/include/latch
index 8e1309ea8899af..cb3366663f21f3 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -96,7 +96,7 @@ public:
inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
void wait() const
{
- __cxx_atomic_wait(&__a_.__a_, [&]() -> bool {
+ __cxx_atomic_wait(&__a_.__a_, [this]() -> bool {
return try_wait();
});
}
More information about the libcxx-commits
mailing list