-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feature request: Construct a fully initialized SliceDeque #75
Comments
Why doesn't |
I believe the SliceDeque is allowed to allocate capacity for more than N items, so |
That's always the case for any collection, e.g., |
Fair enough. I guess having a version of SliceDeque with a guaranteed initialized |
@niklasf I think I misunderstood your problem. You only want a method to initialize the content of the |
Yes. And I'd like to pay the cost only once (when the SliceDeque is initialized, or when it grows). In the file I/O example I am happy with garbage in the tail_head_slice, as long as it is at least initialized memory. I believe this would be sound for |
See #76, which is related. |
So one thing is that, as long as you never exceed the capacity of the For initialization, what you are currently doing is reasonable with the provided API. I'm not sure which API shall (I'm re-opening the issue because I misunderstood your problem, and I need to give an API for this more thought). |
Looking at this old request again, given |
Feature request: A shortcut to create a fully initialized SliceDeque with a given minimum capacity.
Here's my use case, in case this is an XY problem. SliceDeque is useful as a buffer for file I/O. In particular:
However:
So I simply start by
The text was updated successfully, but these errors were encountered: