Bug 12999 – SList: linearRemove cannot remove nodes that came from other SLists
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-27T09:28:00Z
Last change time
2014-06-27T12:37:57Z
Assigned to
nobody
Creator
sigod.mail
Comments
Comment #0 by sigod.mail — 2014-06-27T09:28:11Z
```
auto s = SList!int(1, 2, 3, 4, 5);
auto s2 = SList!int(1, 2, 3, 4, 5);
auto r = s2[];
popFrontN(r, 1);
auto r1 = s.linearRemove(r); // throws exception
```
Is it a bug or intended by design?
Comment #1 by issues.dlang — 2014-06-27T09:36:04Z
It's intended. What would it even mean for it a container to remove elements which are from another container? The values of the elements are irrelevant. You're asking it to remove those specific elements, so they have to be from the container that you're asking to remove them.
Comment #2 by safety0ff.bugz — 2014-06-27T09:42:33Z
It's a documentation bug in my opinion, for example insertAfter specifies that the range r must be a previously extracted range.
Comment #3 by sigod.mail — 2014-06-27T10:37:48Z
(In reply to safety0ff.bugz from comment #2)
> It's a documentation bug in my opinion, for example insertAfter specifies
> that the range r must be a previously extracted range.
What it should be?