std.algorithm and templates
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Dec 10 17:45:15 PST 2014
meat:
> class Woah(){}
> class Bro: Woah{}
> DList!Woah woahs;
>
> and I'm having trouble with..
>
> foreach( bro; woahs.filter!( a => cast(Bro)a !is null))
import std.algorithm, std.container;
class Woah {}
class Bro : Woah {}
void main() {
DList!Woah woahs;
foreach (bro; woahs[].filter!(a => cast(Bro)a !is null)) {}
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list