questions around mutating range algorithms, const, and return ref
aliak
something at something.com
Tue Jan 30 08:18:15 UTC 2018
On Monday, 29 January 2018 at 13:55:04 UTC, Seb wrote:
> On Monday, 29 January 2018 at 11:36:26 UTC, aliak wrote:
>> On Monday, 29 January 2018 at 06:46:26 UTC, Ali Çehreli wrote:
>>> I think the following trivial wrapper around
>>> std.algorithm.remove() should do:
>>>
>>> void removeMatching(R, N)(ref R r, N needles) {
>>> import std.algorithm : remove, canFind;
>>> r = r.remove!(e => needles.canFind(e));
>>> }
>>>
>>
>> Haha awesome! Yes that's much better :)
>>
>> Note to self: learn to scroll down in the docs to find other
>> definitions. I was convinced that remove only acted on indices
>> :p
>
> Not too hard to fix: https://github.com/dlang/phobos/pull/6090
Nice! :D
More information about the Digitalmars-d-learn
mailing list