| 44 | |
| 45 | template<class T> |
| 46 | class weak_ptr |
| 47 | { |
| 48 | public: |
| 49 | using element_type = T; |
| 50 | |
| 51 | /** |
| 52 | * 20.8.2.3.1, constructors: |
| 53 | */ |
| 54 | |
| 55 | constexpr weak_ptr() noexcept |
| 56 | : payload_{} |
| 57 | { /* DUMMY BODY */ } |
| 58 | |
| 59 | template<class U> |
| 60 | weak_ptr( |
| 61 | const shared_ptr<U>& other, |
| 62 | enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr |
| 63 | ) noexcept |
| 64 | : payload_{other.payload_} |
| 65 | { |
| 66 | if (payload_) |
| 67 | payload_->increment_weak(); |
| 68 | } |
| 69 | |
| 70 | weak_ptr(const weak_ptr& other) noexcept |
| 71 | : payload_{other.payload_} |
| 72 | { |
| 73 | if (payload_) |
| 74 | payload_->increment_weak(); |
| 75 | } |
| 76 | |
| 77 | template<class U> |
| 78 | weak_ptr( |
| 79 | const weak_ptr<U>& other, |
| 80 | enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr |
| 81 | ) noexcept |
| 82 | : payload_{other.payload_} |
| 83 | { |
| 84 | if (payload_) |
| 85 | payload_->increment_weak(); |
| 86 | } |
| 87 | |
| 88 | weak_ptr(weak_ptr&& other) noexcept |
| 89 | : payload_{other.payload_} |
| 90 | { |
| 91 | other.payload_ = nullptr; |
| 92 | } |
| 93 | |
| 94 | template<class U> |
| 95 | weak_ptr( |
| 96 | weak_ptr<U>&& other, |
| 97 | enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr |
| 98 | ) noexcept |
| 99 | : payload_{other.payload_} |
| 100 | { |
| 101 | other.payload_ = nullptr; |
| 102 | } |
| 103 |
nothing calls this directly
no test coverage detected