Skip to content

Commit 1fc594f

Browse files
authored
fix: typo in shared_ptr chapter (#32)
This pr has been fixed the typo at section ‘enabled share form this’, shared_ptr in Vol2/Chapter1, Pr checks for document links, site build checked has passed, without importing site build and documentation lint issue.
1 parent 9122a7f commit 1fc594f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

documents/vol2-modern-features/ch01-smart-pointers/03-shared-ptr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void session_demo() {
238238
}
239239
```
240240

241-
⚠️ 使用 `enable_shared_from_this` 有一个前提条件:对象必须已经被一个 `shared_ptr` 管理。如果你在栈上创建对象或用裸指针管理,调用 `shared_from_this()` 会导致未定义行为。此外,构造函数中不能调用 `shared_from_this()`——因为此时 `shared_ptr` 还没有完成构造。
241+
⚠️ 使用 `shared_from_this()` 有一个前提条件:对象必须已经被一个 `shared_ptr` 管理。如果你在栈上创建对象或用裸指针管理,调用 `shared_from_this()` 会导致未定义行为。此外,构造函数中不能调用 `shared_from_this()`——因为此时 `shared_ptr` 还没有完成构造。
242242

243243
## 常见误用与踩坑
244244

0 commit comments

Comments
 (0)