From 4c70c7732faa91ca3a0118dc2fbc583914acd5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Dee=20=28J=C5=8Dshin=29?= Date: Fri, 18 Apr 2025 00:49:42 -0700 Subject: [PATCH] Write the general operator= on weak_ptr --- ctl/shared_ptr.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ctl/shared_ptr.h b/ctl/shared_ptr.h index 4c3b23ca7..5db5ec01c 100644 --- a/ctl/shared_ptr.h +++ b/ctl/shared_ptr.h @@ -444,6 +444,13 @@ class weak_ptr return *this; } + template + requires __::shared_ptr_compatible + weak_ptr& operator=(weak_ptr r) noexcept + { + weak_ptr(move(r)).swap(*this); + } + shared_ptr lock() const noexcept { if (expired())