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

RedBlackTreeSet could have a pop_{first, last} methods #35

Open
Eh2406 opened this issue Jun 11, 2018 · 2 comments
Open

RedBlackTreeSet could have a pop_{first, last} methods #35

Eh2406 opened this issue Jun 11, 2018 · 2 comments

Comments

@Eh2406
Copy link

Eh2406 commented Jun 11, 2018

I was experimenting with using a RedBlackTree as a priority queue and ended up with:

let next_work = queue.first();
if let Some(k) = next_work {
    queue.remove_mut(k);
}

It would be nice to have a pop_first that removed the first item and returned it in one.

@orium
Copy link
Owner

orium commented Jun 11, 2018

Sounds good. If you want to take it and do a PR go for it :)

@Eh2406
Copy link
Author

Eh2406 commented Jun 12, 2018

looks like std calls somthing similar take.

As to doing a PR, I do not know the internals of rpds. I don't think I will have the spare cycles to figure it out.

@orium orium changed the title RedBlackTreeSet could have a pop_{first, last} methode RedBlackTreeSet could have a pop_{first, last} methods Sep 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants