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

Lifetime of returned next references #2

Open
tommie opened this issue Jul 17, 2024 · 0 comments
Open

Lifetime of returned next references #2

tommie opened this issue Jul 17, 2024 · 0 comments

Comments

@tommie
Copy link

tommie commented Jul 17, 2024

I'm interested in bplustree, because it seems to allow removal/insertion without invalidating iterators, something it seems BTreeMap cannot do without cursors, which are only in nightly.

However, I'm hitting a lifetime issue with RawExclusiveIter::next:

pub fn next(&mut self) -> Option<(&K, &V)> {

The associated type in btree_map::Iter uses the container's lifetime:

type Item = (&'a K, &'a V)

which suggests the returned references should be tagged with 't in bplustree, since the underlying data should be valid even as the iterator is dropped.

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

No branches or pull requests

1 participant