Skip to content
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

std.container: RedBlackTree.remove readability enhancement. #2247

Merged
merged 1 commit into from
Jun 29, 2014

Conversation

Safety0ff
Copy link
Contributor

Minor change to make the code easier to read.

@schveiguy
Copy link
Member

Seems fine. Looking at your change, I wonder if y should just go away, and use ret instead.

@Safety0ff
Copy link
Contributor Author

I don't think replacing y for ret is an improvement.
The section where y is used could almost directly be moved to a separate swapping function. e.g.:
// if this node has 2 children
if (_left !is null && _right !is null)
swap(this, ret); // stable: only swaps pointers
So its probably better to treat it as a separate subroutine for reading purposes.

@monarchdodra
Copy link
Collaborator

If possible, I'd like this to not be merged before #2174.

@Safety0ff
Copy link
Contributor Author

ping, #2174 has been merged and I've rebased this.

@DmitryOlshansky
Copy link
Member

Auto-merge toggled on

DmitryOlshansky added a commit that referenced this pull request Jun 29, 2014
std.container: RedBlackTree.remove readability enhancement.
@DmitryOlshansky DmitryOlshansky merged commit d9684cc into dlang:master Jun 29, 2014
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.

None yet

4 participants