On Tuesday, 10 October 2023 at 11:45:25 UTC, Dennis wrote:
The result of `.stringof` is implementation defined, it can be used for debugging but don't make your program's semantics depend on the output of it.

...

...

...That being said, this trick can be used to convert an integer to string at compile time:


```D
enum itoa(int i) = i.stringof;

static foreach(i; 0 .. 10) {
  mixin(create_fn!(itoa!i));
}
```

Technically not reliable, but I don't expect integers to ever get printed differently than a string of base 10 digits.

Thank you! It is great and works great. I will however use the example from Imperatorn as it does not use ".stringof". Have an amazing day!

Reply via email to