vault backup: 2022-06-06 10:34:20

Affected files:
.obsidian/workspace
02. PARA/03. Resources(資源)/C++17/智慧指標.md
This commit is contained in:
2022-06-06 10:34:20 +08:00
parent fd5c54fbfa
commit fc6b4647aa
2 changed files with 12 additions and 6 deletions

View File

@@ -0,0 +1,6 @@
unique_ptr與shared_ptr都是智慧指標箱對於原本的raw pointer智慧指標使用起來更方便也不用擔心delete的問題。
## unique_ptr
unique_ptr的特點是它保證在一個時間內只會有一個指標的擁有者也就是這個指標不能被複製跟移動當unique_ptr離開它的scope時候它所擁有的pointer也隨之被delete。這讓你不用擔心memoo
## shared_ptr