[Request] A way to extract all instance of X from a range
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 14 17:22:05 PDT 2016
On Monday, 14 March 2016 at 23:34:37 UTC, Stefan Koch wrote:
> On Monday, 14 March 2016 at 08:04:18 UTC, deadalnix wrote:
>> Right now, I'm repeating the following pattern many times :
>>
>> range.map!(x => cast(Foo) x).filter!(x => x !is null)
>>
>> Which is kind of annoying. Could we get something in phobos to
>> do this ?
>
> There you go ;)
>
> alias castRange(T) = map!(x => cast(T) x).filter!(x => x !is
> null);
Ooops ;) didn't work
then it'll has to be done with a wrapper struct ...
More information about the Digitalmars-d
mailing list