On 01.07.2024 15:26, ryuukk_ wrote:
Ok, i'll just do it and benchmark at the end

Another question:


Why doesn't this work?:


I'm pretty sure your code does not work the way you think it does. String Mixins and Template Mixins are two different things. If you want to use String Mixins just make a function that creates a complete string with the source code and then mix it in. No need for Template Mixins in this case.

```D
string generateSourceCode(T)()
{
     return T.stringof ~ "* ctx;";
}

void main()
{
    mixin(generateSourceCode!int);

    static assert(is(typeof(ctx) == int*));

    assert(ctx is null);
}
```

Reply via email to