-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
std: add std.ArrayList.remove #2262
Conversation
71102ba
to
3af2430
Compare
I'm on board with adding this function, but since it has an important caveat of O(N) performance, I'd like to request the following changes:
|
I was thinking that it would be good if zig container types all had the same API (for operations they support), with big-O behaviour documented in e.g. a table. Similar to C++
|
Please take this question earnestly - I'm not trying to be condescending - can you explain this reasoning? Other than a vague sense of tidiness that one gets from cleaning their room. |
I guess being explicit here is important as there is more than one valid way to remove an element from an ArrayList. There's the shift method being implement here that has certain run time characteristics that people with large arrays may not like but keeps the original order. Then there is the swap with the last element and just decrease the size, not great if you need to keep your Array list ordered but has constant performance characteristics. |
See #2247 (comment). |
@daurnimator you good with |
I'm okay with it; I'd still like to call it |
3af2430
to
b49e2a1
Compare
Closes #2247
Required for a sensible http headers object.