D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5345 - std.array is missing the remove functions from std.container
Summary: std.array is missing the remove functions from std.container
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-12 18:04 UTC by Jonathan M Davis
Modified: 2015-06-09 01:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2010-12-12 18:04:29 UTC
Containers in std.container implement a certain set of functions - including various remove functions. std.array currently implements the various range functions that arrays are supposed to have, but it does _not_ implement any of the container functions. In particular, it lacks the various remove functions. These functions should be added to std.array:

removeFront() (presumably just an alias for popFront())

removeBack()  (presumably just an alias for popBack())

linearRemove()

removeAny() (presumably an alias for popFront())


I'm not sure if they can implement the stable versions or not, since I'm not really sure what the docs mean when they're talking about iterators given that D doesn't generally use them. I would have expected it to refer to ranges, but since an array _is_ range that could get a bit funny... In any case, whatever subset of the various remove functions would be appropriate for arrays should be added to std.array.
Comment 1 Jonathan M Davis 2011-02-26 06:06:34 UTC
Actually. I'm not sure that we want to add these. The more I think about it, the less convinced I am that we want to treat dynamic arrays like containers. It generally makes better sense to treat them as ranges. However, since they _are_ a bit schizophrenic about whether they're ranges or containers, I'm not entirely sure what the best course is here. I _am_ leaning towards just treating them as ranges though.
Comment 2 Jonathan M Davis 2012-01-20 23:13:33 UTC
Not a good idea. Dynamic arrays are _not_ containers. Closing.