April 07, 2014 [Issue 8772] DList.remove doesn't work with result of std.range.take | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=8772 monarchdodra@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |monarchdodra@gmail.com Resolution| |INVALID --- Comment #3 from monarchdodra@gmail.com 2014-04-07 07:49:12 PDT --- This is invalid, as "remove" is a "O(1)" operation, but removing a Take!Range is linear operation. So that's an invalid argument. The correct way to remove a Take!Range, is to use the linear removal function: linearRemove: //---- import std.range, std.algorithm, std.container; void main() { auto list = DList!int([1,2,3,4,5]); list.linearRemove(list[].find(3).take(1)); } //---- Well, that's how it is right now anyways. If/when DList will have deterministic ownership of its elements, things could change, since it would have to call destructor on the removed elements... -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation