Defining a static array with values in a range

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 22 11:05:07 PST 2015


On Thursday, 22 January 2015 at 19:00:47 UTC, zeljkog wrote:
> On 22.01.15 19:26, Meta wrote:
>> On Thursday, 22 January 2015 at 18:23:00 UTC, Meta wrote:
>> Whoops, I forgot to make it a template to force CTFE.
>>
>
> You can force CTFE assigning to manifest constant.
>
> enum t = charRange!...

By wrapping it in a template the array will always be generated 
at compile time, even if you assign it to a runtime variable.


More information about the Digitalmars-d-learn mailing list