Defining a static array with values in a range

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


On Thursday, 22 January 2015 at 19:12:32 UTC, zeljkog wrote:
> On 22.01.15 20:05, Meta wrote:
>> 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.
>
> Yes, but then you can not use runtime spec.

OP wanted it to be done at compile time.


More information about the Digitalmars-d-learn mailing list