pitfalls of enum
Timothee Cour
thelastmammoth at gmail.com
Fri Nov 15 00:06:20 PST 2013
On Thu, Nov 14, 2013 at 5:02 PM, bearophile <bearophileHUGS at lycos.com>wrote:
> Ali Çehreli:
>
>
> > When is an enum *better* than a normal (static
>> const/immutable) constant?
>>
>> Good question. :)
>>
>
> When you can or want to compute something at compile-time, when you need
> values to feed to templates, etc.
>
>
but you can *can* do that with static const /const/immutable variables too:
auto fun2(int a)(int b){...}
immutable a=fun(2);//static const /const/immutable/enum
auto b=fun2!a(3);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131115/bded5f40/attachment.html>
More information about the Digitalmars-d-learn
mailing list