Compile-Time Only Function
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 23 05:33:01 PDT 2017
On Friday, 23 June 2017 at 12:29:09 UTC, Moinak Bhattacharyya
wrote:
> 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?
The the one from
https://github.com/UplinkCoder/bf-ctfe/blob/master/source/bf_compiler.d
and
https://github.com/UplinkCoder/bf-ctfe/blob/master/source/bf_fastmath.d
More information about the Digitalmars-d
mailing list