Skip to content

fix: typo in shared_ptr chapter#32

Merged
Charliechen114514 merged 1 commit into
Awesome-Embedded-Learning-Studio:mainfrom
YukunJ:fix-typo
Jun 2, 2026
Merged

fix: typo in shared_ptr chapter#32
Charliechen114514 merged 1 commit into
Awesome-Embedded-Learning-Studio:mainfrom
YukunJ:fix-typo

Conversation

@YukunJ
Copy link
Copy Markdown
Contributor

@YukunJ YukunJ commented Jun 1, 2026

Brief: Found this typo while I read through this chapter. I believe the author mean shared_from_this

https://en.cppreference.com/cpp/memory/enable_shared_from_this/shared_from_this

Exceptions
If shared_from_this is called on an object that is not previously shared by std::shared_ptr, std::bad_weak_ptr is thrown by the std::shared_ptr constructor.

@Charliechen114514

@Charliechen114514
Copy link
Copy Markdown
Member

您好!这里非常感谢您的修正!

我重新检查了原文上下文,这里的修改是正确的。这条 warning 具体讨论的是“对象尚未被 std::shared_ptr 管理时调用会出错”的行为,因此主语应当是 shared_from_this(),而不是 enable_shared_from_this 本身。

这是我编写时的疏忽,可能给您和其他读者造成了一些困惑,对此表示非常抱歉。由于一些个人原因,我暂时没办法立刻将您的贡献同步到网站中;我计划在 6 月 7 日单独提交一个 PR 来完成网站内容同步。

最后,再次感谢您的帮助!

Thank you very much for the correction!

I rechecked the surrounding context, and this change is correct. The warning is specifically about the behavior of calling shared_from_this() when the object is not yet managed by a std::shared_ptr, so the subject here should be shared_from_this() rather than enable_shared_from_this itself.

This was an oversight on my part when writing the chapter, and I apologize if it caused any confusion for you or other readers. For some personal reasons, I am not able to sync your contribution to the website immediately. I plan to submit a separate PR on June 7 to update the website content accordingly.

Thanks again for your help!

@Charliechen114514 Charliechen114514 merged commit 1fc594f into Awesome-Embedded-Learning-Studio:main Jun 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants