[libcxx-commits] [libcxx] [libc++] Implement P1901R2: owner_hash and owner_equal for shared_ptr/weak_ptr (PR #210551)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 22 01:21:18 PDT 2026


================
@@ -555,6 +556,22 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI shared_ptr {
 
   _LIBCPP_HIDE_FROM_ABI bool __owner_equivalent(const shared_ptr& __p) const { return __cntrl_ == __p.__cntrl_; }
 
+#if _LIBCPP_STD_VER >= 26
+  [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t owner_hash() const _NOEXCEPT {
----------------
frederick-vs-ja wrote:

In C++26 code we should use pretty forms. Same for other functions.
```suggestion
  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t owner_hash() const noexcept {
```

https://github.com/llvm/llvm-project/pull/210551


More information about the libcxx-commits mailing list