One liner for creating an array filled by a factory method

kerdemdemir kerdemdemir at gmail.com
Thu Dec 21 21:00:06 UTC 2017


I have a case like :

http://rextester.com/NFS28102

I have a factory method, I am creating some instances given some 
enums.
My question is about :


void PushIntoVector( BaseEnum[] baseEnumList )
{
     Base[] baseList;
     foreach ( tempEnum; baseEnumList )
     {
        baseList ~= Factory(tempEnum);
     }
}

I don't want to use "foreach" loop. Is there any cool std 
function that I can call ?

Something like baseEnumList.CoolStdFunc!( a=> Factory(a)  
)(baseList);

Erdem


More information about the Digitalmars-d-learn mailing list