D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12999 - SList: linearRemove cannot remove nodes that came from other SLists
Summary: SList: linearRemove cannot remove nodes that came from other SLists
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-27 09:28 UTC by sigod
Modified: 2014-06-27 12:37 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description sigod 2014-06-27 09:28:11 UTC
```
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 Jonathan M Davis 2014-06-27 09:36:04 UTC
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 safety0ff.bugz 2014-06-27 09:42:33 UTC
It's a documentation bug in my opinion, for example insertAfter specifies that the range r must be a previously extracted range.
Comment 3 sigod 2014-06-27 10:37:48 UTC
(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?