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.
Cascaded allocator #2113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Cascaded allocator #2113
Changes from 4 commits
bd320b1
37dc8f4
c61b9be
6166f88
32d3d1f
e2a5511
6835890
150eb7b
089af45
ac87bd4
b71f82d
34abb6e
cf39680
78e7165
e5e55bc
00016bf
912d9db
833bc87
40675b0
148734d
6e9a17c
d065069
eba85a4
1e1862d
0f26ecb
4a7fcd0
cf686b3
4c27ab0
8210ac0
e8d9b51
63e543f
d4e7d14
874d9cb
92066a1
4a9c114
8450156
0c8067c
cc4053c
ac5f611
fec93be
42b409e
a837b5d
c9ead44
021ef62
92c3499
b84e0c4
58da8c3
818c631
76ceba9
c19e903
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when push_back fails it will throw, maybe use std::unique_ptr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These APIs have strong exception safety guarantee, so there is no need to use std::unique_ptr.
Is it true ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, I can see the result of these calls to judge whether potential exceptions have occurred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://en.cppreference.com/w/cpp/language/exceptions, push_back can throw, when it does the state of the std::vector is guaranteed at that moment, but it will not just return. The exception should go back to the caller to my idea, your allocator should not leak when push_back (or any operation it uses) throws
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when using unique_ptr the check after the push_back seems invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have used std::unique_ptr for idiom in new commit
But for a vector of pointer, I think sdt::vector can keep strong exception guarantee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, Your idea is right!
The APIs provide strong exception guarantee, but not Nothrow
I will delete the defence codes