| 181 | } |
| 182 | |
| 183 | ~shared_ptr() |
| 184 | { |
| 185 | if ( shared_node != 0) |
| 186 | { |
| 187 | if (shared_node->ref_count == 1) |
| 188 | { |
| 189 | // delete the data in the appropriate way |
| 190 | shared_node->del->del(data); |
| 191 | delete shared_node->del; |
| 192 | |
| 193 | // notify any weak_ptrs that the data has now expired |
| 194 | if (shared_node->weak_node) |
| 195 | shared_node->weak_node->shared_node = 0; |
| 196 | |
| 197 | // finally delete the shared_node |
| 198 | delete shared_node; |
| 199 | } |
| 200 | else |
| 201 | { |
| 202 | shared_node->ref_count -= 1; |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | shared_ptr( |
| 208 | const shared_ptr& r |