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

please expose resize #13

Open
rr0gi opened this issue Feb 9, 2022 · 5 comments
Open

please expose resize #13

rr0gi opened this issue Feb 9, 2022 · 5 comments

Comments

@rr0gi
Copy link

rr0gi commented Feb 9, 2022

to be able to reserve buckets when number of elements is known in advance before insertion

@ikod
Copy link
Owner

ikod commented Feb 9, 2022

Thanks @rr0gi

Will check today

ikod pushed a commit that referenced this issue Feb 13, 2022
@ikod
Copy link
Owner

ikod commented Feb 13, 2022

hello, @rr0gi

please check this commit

@rr0gi
Copy link
Author

rr0gi commented Feb 14, 2022

I think it should also check if new_size is bigger than current allocated (smaller than current size is ok to allow to shrink unused buckets, but smaller than number of allocated items is unlikely something that anybody may want)

@rr0gi
Copy link
Author

rr0gi commented Feb 15, 2022

(btw thanks to the added comment I noticed that capacity is actual_size - allocated, which is somewhat unexpected, in other libraries I used before capacity is actual_size and then the callers can substract themselves if needed, not sure if it is worth changing, just pointing out)

@ikod
Copy link
Owner

ikod commented Feb 15, 2022

I think it should also check if new_size is bigger than current allocated (smaller than current size is ok to allow to shrink unused buckets, but smaller than number of allocated items is unlikely something that anybody may want)

Agree, thanks

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

2 participants