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

What to do about the reserve functions #21

Open
AaronKutch opened this issue Sep 5, 2023 · 0 comments
Open

What to do about the reserve functions #21

AaronKutch opened this issue Sep 5, 2023 · 0 comments

Comments

@AaronKutch
Copy link
Owner

I must have looked over the Vec::reserve documentation a dozen times, and somehow I never noticed that it reserves at least self.len() + additional and not self.capacity() + additional, meaning that self.reserve(self.capacity()) can do nothing instead of doubling the capacity. I only now found about this in another project where it caused an unexpected infinite loop. The previous versions of triple_arena happened to be ultimately based on length and never encountered the problem, and in the current version NonZeroInxVec uses the formulation I always assumed was the case. Should I change the behavior of all the reserve functions?

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