On Wednesday, 22 January 2014 at 16:48:45 UTC, bearophile wrote:
monarch_dodra:
There's no phobos solution for that,
There will be.
In the meantime use:
items = items.remove(items.countUntil(needle));
Hum... that requires iterating the range twice for a non-RA
range. And you forgot a save
monarch_dodra:
There's no phobos solution for that,
There will be.
In the meantime use:
items = items.remove(items.countUntil(needle));
See also:
https://d.puremagic.com/issues/show_bug.cgi?id=10959
Bye,
bearophile
On Wednesday, 22 January 2014 at 15:41:58 UTC, bearophile wrote:
monarch_dodra:
Maybe you confusing the new style lambda for a "greater equal"
operator? I can't make sense of your question any other way.
My point was that the shown code doesn't remove only one item
in presence of duplicated
monarch_dodra:
Maybe you confusing the new style lambda for a "greater equal"
operator? I can't make sense of your question any other way.
My point was that the shown code doesn't remove only one item in
presence of duplicated ones. In this case tid are unique, but in
general using that code
On Wednesday, 22 January 2014 at 13:51:51 UTC, bearophile wrote:
Casper Færgemand:
To remove an element, I *think* you do it this way:
tids = tids.remove!(a=>a == tid)();
is that removing only 0 or 1 items?
Bye,
bearophile
Maybe you confusing the new style lambda for a "greater equal"
op
On Wednesday, 22 January 2014 at 13:51:51 UTC, bearophile wrote:
Casper Færgemand:
To remove an element, I *think* you do it this way:
tids = tids.remove!(a=>a == tid)();
is that removing only 0 or 1 items?
Bye,
bearophile
It removes all items that match the tid.
Casper Færgemand:
To remove an element, I *think* you do it this way:
tids = tids.remove!(a=>a == tid)();
is that removing only 0 or 1 items?
Bye,
bearophile
On Wednesday, 22 January 2014 at 13:16:18 UTC, monarch_dodra
wrote:
Because "remove" takes an "offset" as an argument, not an
element.
To remove an element, I *think* you do it this way:
tids = tids.remove!(a=>a == tid)();
Thanks a lot. I was trying to get that part to work, but I had a
har
On Wednesday, 22 January 2014 at 12:11:22 UTC, Casper Færgemand
wrote:
import std.algorithm;
import std.concurrency;
void main() {
Tid[] tids = [];
Tid tid = thisTid;
tids ~= tid;
tids.remove(tid);
}
Why does this not compile?
Because "remove" takes an "offset"