What's equivalent to C#'s select?
drug
drug2004 at bk.ru
Sun Jan 14 21:38:39 UTC 2018
15.01.2018 00:21, Marc пишет:
> give a list, how can I select only the elements of a range according to
> a condition give by a lamba function?
>
> something like this:
>
>> auto l = myList.select(e => e.id < 300);
>
> it would return a range. Similar to C#'s select:
>
> https://msdn.microsoft.com/en-us/library/bb548891(v=vs.110).aspx
import std.algorithm : filter;
auto l = myList.filter!(e => e.id < 300);
More information about the Digitalmars-d-learn
mailing list