Write the general operator= on weak_ptr

This commit is contained in:
Steven Dee (Jōshin) 2025-04-18 00:49:42 -07:00
parent 43ad99595b
commit 4c70c7732f
No known key found for this signature in database

View file

@ -444,6 +444,13 @@ class weak_ptr
return *this;
}
template <typename U>
requires __::shared_ptr_compatible<T, U>
weak_ptr& operator=(weak_ptr<U> r) noexcept
{
weak_ptr<T>(move(r)).swap(*this);
}
shared_ptr<T> lock() const noexcept
{
if (expired())