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

Add liniarRemoveElement for Dlist #5786

Merged
merged 1 commit into from Oct 24, 2017

Conversation

Darredevil
Copy link
Contributor

https://issues.dlang.org/show_bug.cgi?id=9362

Followed the idea from #5784 and implemented the same for Dlist.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @Darredevil! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@Darredevil Darredevil force-pushed the issue-9362-dlist-remove branch 3 times, most recently from 808a205 to ac3a226 Compare October 17, 2017 13:22
@Darredevil
Copy link
Contributor Author

@andralex awaiting approval

private:

BaseNode* findNodeByValue(BaseNode* n, T value)
{
assert(n, "Error: un-initialized List");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you just return null if the list is not initialized?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also prefer to return null instead of asserting, though all the other findNode* functions do the same.

@@ -766,6 +804,34 @@ private:
{
import std.algorithm.comparison : equal;

auto a = DList!int(-1, 1, 2, 1, 3, 4);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should include a test involving an empty list

@Darredevil
Copy link
Contributor Author

@andralex @ZombineDev should be ready for merge

bool linearRemoveElement(T value)
{
auto n1 = findNodeByValue(_root, value);
// if node exists
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete, just repeats what the code says

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants