lambda template literals?

Timon Gehr timon.gehr at gmx.ch
Tue Jan 17 16:47:22 PST 2012


On 01/18/2012 01:35 AM, bearophile wrote:
> Is code vaguely like this meaningful and useful?
>
>
> void main() {
>      alias (x =>  x ^^ 2) sqrTemplate;
> }
>
>
> Bye,
> bearophile

Yes. The fact that your particular example does not work is a mere 
syntactic issue.
This works:

template ID(alias a){alias a ID;}
void main(){
     alias ID!(x => x ^^ 2) sqrTemplate;
}



More information about the Digitalmars-d-learn mailing list