Using a string generated at compile-time in a @nogc function
Mithun Hunsur via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun May 1 03:25:16 PDT 2016
On Sunday, 1 May 2016 at 08:14:43 UTC, Nicholas Wilson wrote:
> On Sunday, 1 May 2016 at 05:28:36 UTC, Mithun Hunsur wrote:
>> Hi all,
>>
>> I'm working on removing the string mixins from my code, but
>> have run into an issue:
>>
>> http://dpaste.dzfl.pl/ecd7eb53947e
>>
>> As far as I can tell, this should work; the enum should force
>> compile-time execution (which it does, as evidenced by the
>> pragma). I've worked around this by employing a string mixin,
>> but it's not as clean:
>>
>> http://dpaste.dzfl.pl/021c4a849b32
>>
>> Any insight would be appreciated :)
>
> Have you tried using a static (as in inside the function)
> static array of strings?
I considered it briefly, but opted against it because it adds
unnecessary overhead (both time and space) - while minor, I'm not
going to concede that quickly :P
More information about the Digitalmars-d-learn
mailing list