Skip to content

Clarify safety of std::unique_ptr#296

Merged
changkun merged 1 commit into
changkun:masterfrom
frederick-vs-ja:clarify-uniqueness
Jun 7, 2026
Merged

Clarify safety of std::unique_ptr#296
changkun merged 1 commit into
changkun:masterfrom
frederick-vs-ja:clarify-uniqueness

Conversation

@frederick-vs-ja
Copy link
Copy Markdown
Contributor

resolve #282

Description

Clarify under which conditions unique_ptr guarantees safety, because it can't introduce absolute safety.

Change List

  • Add description regarding the non-copyability of unique_ptr

Reference


说明

澄清 unique_ptr 在何种情况下保证安全,因为它不可能带来绝对的安全。

变化箱单

  • 增加了 unique_ptr 不可复制相关的说明

参考文献

@changkun changkun merged commit a36b6b7 into changkun:master Jun 7, 2026
@changkun
Copy link
Copy Markdown
Owner

changkun commented Jun 7, 2026

Merged — thanks @frederick-vs-ja. Spelling out that std::unique_ptr forbids sharing via copy construction / copy assignment, and that this avoids double-destruction/double-free, is exactly the precision this paragraph needed. This also resolves #282. 🙏

@frederick-vs-ja frederick-vs-ja deleted the clarify-uniqueness branch June 7, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

std::unique_ptr 概念描述不够清晰

2 participants