Compile-Time Only Function

Moinak Bhattacharyya via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 23 05:29:09 PDT 2017


On Friday, 23 June 2017 at 12:23:23 UTC, Mike wrote:
> alias immutable(char)[] string;
>
> string GenString(string a, string b)
> {
>     return a ~ ", " ~ b;
> }
>
> void main()
> {
>     // `result` is a manifest constant that contains your
>     // compile-time string, do as you wish with it
>     enum result = GenString("Hello", "World");
> }

The problem is, I have to concat a string with an int thus I need 
to use std.conv. This creates all sorts of problems. Do i really 
need to create my own itoa function?


More information about the Digitalmars-d mailing list