mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-13 06:29:11 +00:00
Write the general operator= on weak_ptr
This commit is contained in:
parent
43ad99595b
commit
4c70c7732f
1 changed files with 7 additions and 0 deletions
|
@ -444,6 +444,13 @@ class weak_ptr
|
||||||
return *this;
|
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
|
shared_ptr<T> lock() const noexcept
|
||||||
{
|
{
|
||||||
if (expired())
|
if (expired())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue