Files
cppdraft_translate/cppdraft/util/smartptr/weak/assign.md
2025-10-25 03:02:53 +03:00

1.7 KiB
Raw Blame History

[util.smartptr.weak.assign]

20 Memory management library [mem]

20.3 Smart pointers [smartptr]

20.3.2 Shared-ownership pointers [util.sharedptr]

20.3.2.3 Class template weak_ptr [util.smartptr.weak]

20.3.2.3.4 Assignment [util.smartptr.weak.assign]

🔗

constexpr weak_ptr& operator=(const weak_ptr& r) noexcept; template<class Y> constexpr weak_ptr& operator=(const weak_ptr<Y>& r) noexcept; template<class Y> constexpr weak_ptr& operator=(const shared_ptr<Y>& r) noexcept;

1

#

Effects: Equivalent to weak_ptr(r).swap(*this).

2

#

Returns: *this.

3

#

Remarks: The implementation may meet the effects (and the implied guarantees) via different means, without creating a temporary object.

🔗

constexpr weak_ptr& operator=(weak_ptr&& r) noexcept; template<class Y> constexpr weak_ptr& operator=(weak_ptr<Y>&& r) noexcept;

4

#

Effects: Equivalent to weak_ptr(std::move(r)).swap(*this).

5

#

Returns: *this.