[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
================
@@ -1318,6 +1351,44 @@ struct owner_less<void> {
};
#endif
+#if _LIBCPP_STD_VER >= 26
+struct owner_hash {
+ template <class _Tp>
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(shared_ptr<_Tp> const& __p) const _NOEXCEPT {
+ return __p.owner_hash();
+ }
+ template <class _Tp>
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t operator()(weak_ptr<_Tp> const& __p) const _NOEXCEPT {
+ return __p.owner_hash();
+ }
+ typedef void is_transparent;
----------------
frederick-vs-ja wrote:
Same for `owner_equal`.
```suggestion
using is_transparent = void;
```
(Also, it seems a bit clear to add an empty line here).
https://github.com/llvm/llvm-project/pull/210551
More information about the libcxx-commits
mailing list