Unable to instantiate template with same name as function

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 4 20:58:53 PST 2016


@AliCehreli: you may consider including Jonathan's trick in your book in the 
para above this heading: 
http://ddili.org/ders/d.en/const_and_immutable.html#ix_const_and_immutable.variable,
%20immutable

Jonathan M Davis via Digitalmars-d-learn wrote:

> yes, having
> 
> enum s = ta("s)";
> 
> and using s all over the place will result in an allocation each time that
> s is used. However, you can combine the two and avoid that problem. e.g.
> 
> enum e = ta("s");
> string s = e;
> 
> The ta is run at compile time, and it's only evaluated once.

-- 
Shriramana Sharma, Penguin #395953


More information about the Digitalmars-d-learn mailing list