shared_ptr初始化为null
时间: 2023-10-17 18:35:50 浏览: 122
在给定的代码中,shared_ptr `client` 被初始化为 `NULL`(即空指针)。这是因为在调用 `client.reset()` 后,`client` 不再指向任何有效的对象。所以,在 `if (client == NULL)` 的条件下,程序会输出 "client is null"。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [将boost::shared_ptr设置为NULL的方法](https://blog.csdn.net/lizhi200404520/article/details/39316871)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [C++智能指针的原理和实现.pdf](https://download.csdn.net/download/qq_43934844/87504589)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文