vault backup: 2022-06-09 14:50:27

Affected files:
.obsidian/workspace
02. PARA/03. Resources(資源)/C++17/rvalue.md
02. PARA/03. Resources(資源)/C++17/智慧指標.md
This commit is contained in:
2022-06-09 14:50:27 +08:00
parent a7a1b5b650
commit 5d6888028a
3 changed files with 29 additions and 22 deletions

View File

@@ -68,7 +68,7 @@ auto ptr1 = std::make_unique<int>(5);
auto anotherPtr = std::move(ptr1);
```
ptr1原本所管理的指標會轉移給 anotherPtr
ptr1原本所管理的指標會轉移給 anotherPtrptr1 會變成 nullptr。
## shared_ptr
建立一個 `shared_ptr` 是使用[`std::make_shared()`](https://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared)