Using a string generated at compile-time in a @nogc function

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 1 01:14:43 PDT 2016


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?




More information about the Digitalmars-d-learn mailing list