How to delete element from array container or dlist?

Andrey Kabylin andrey at kabylin.ru
Sun Mar 18 15:42:18 UTC 2018


On Sunday, 18 March 2018 at 15:32:47 UTC, Michael wrote:
> On Sunday, 18 March 2018 at 14:58:52 UTC, Andrey Kabylin wrote:
>> In DList we have method remove, but I can't understand how 
>> this method works, I want write somethink like this:
>>> void unsubscribe(EventsSubscriber subscriber) {
>>>     subscribers.remove(subscriber);
>>> }
>
> So I guess you would want something like
>
> subscribers.remove!(a => a == subscriber));
>
> which is the different definition of remove available here:
> https://dlang.org/phobos/std_algorithm_mutation.html#.remove.2

Yes this works, thanks!


More information about the Digitalmars-d-learn mailing list