On Friday, 26 February 2016 at 11:07:28 UTC, BBasile wrote:
On Friday, 26 February 2016 at 11:03:43 UTC, Dibyendu Majumdar wrote:
How do I use a double value in a mixin template that is generating string?

Have you an example of what's failing right now to show ?

I am trying something like this:

template MyTAlloc(int n_vars, double v) {
const char[] MyT = "MyT_init(cast(MyT *) alloca(alloc_size(" ~ n_vars ~ ")), " ~ n_vars ~ ", " ~ v ~ ")";
}

MyT *t = mixin(MyTAlloc!(2,5.0));

Error: incompatible types for (("MyT_init(cast(MyT *) alloca(alloc_size(" ~ cast(immutable(char))2 ~ ")), " ~ cast(immutable(char))2 ~ ", ") ~ (5.00000)): 'string' and 'double'

Reply via email to