Add a check for begin == end to allow users to supply an empty list to lockfree::stack::push#21
Open
cdglove wants to merge 1 commit intoboostorg:developfrom
Open
Add a check for begin == end to allow users to supply an empty list to lockfree::stack::push#21cdglove wants to merge 1 commit intoboostorg:developfrom
cdglove wants to merge 1 commit intoboostorg:developfrom
Conversation
…o lockfree::stack::push
Collaborator
|
needs a test, will look into it |
Contributor
Author
|
It's a question of if we want to impose the check on all callers even if they know for sure that their list is not empty. It might be a bit pessimistic to put the check inside push because then everyone pays for the cost of the branch. An ASSERT might also be acceptable. |
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.
I'm not 100% sure if this is desirable or not. A simple test is something like this;
This will crash (in debug at least), when dereferencing the begin iterator. However, it's possible this is as designed because it's expected that the user doesn't supply an empty list. I'm OK with either, but did hit this today.