fix: add proof for the std::pmr::vector that it only use the stack space buffer instead of heap#77
Merged
Charliechen114514 merged 1 commit intoJun 23, 2026
Conversation
…ace buffer instead of heap
Member
|
感谢贡献!(最近才知道可以@人提示,手动捂脸) 的确这个地方少了一部分论证。您用地址范围比对把这点坐实了:v.data() 落在 [buffer, buffer+sizeof(buffer)] 内,论证清晰,附的 godbolt 链接也很贴心! PS: 刚好这边就在小重构Vol3的内容,13-custom-allocators.md 之后会迁移到一个子目录中!届时我会把这段证明一起带到新位置,不会丢。;) Thank you for your contribution! (I only recently learned that you can @ someone for a prompt) Indeed, this part of the argument was lacking. You have confirmed it using address range comparison: v.data() falls within [buffer, buffer + sizeof(buffer)], making the argument clear. The attached Godbolt link is also very considerate! PS: I happen to be doing a minor refactoring of Vol3 here. 13-custom-allocators.md you changed will be moved to a subdirectory! At that time, I will also move this proof to the new location, it won't be lost ;) |
97f0b1f
into
Awesome-Embedded-Learning-Studio:main
4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief: Augment the code sample in
std::pmr::vectorsection.The tutorial states
"vector 的内存来自栈上 buffer,零全局堆分配"without actually prove it.QA:
see godbolt reference: https://godbolt.org/z/WxjTb8oW5
@Charliechen114514