Files
Obsidian-Main/02. PARA/03. Resources(資源)/C++17/智慧指標.md
Awin Huang fc6b4647aa vault backup: 2022-06-06 10:34:20
Affected files:
.obsidian/workspace
02. PARA/03. Resources(資源)/C++17/智慧指標.md
2022-06-06 10:34:20 +08:00

6 lines
423 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
unique_ptr與shared_ptr都是智慧指標箱對於原本的raw pointer智慧指標使用起來更方便也不用擔心delete的問題。
## unique_ptr
unique_ptr的特點是它保證在一個時間內只會有一個指標的擁有者也就是這個指標不能被複製跟移動當unique_ptr離開它的scope時候它所擁有的pointer也隨之被delete。這讓你不用擔心memoo
## shared_ptr