Hi,
How do I use a double value in a mixin template that is
generating string?
Thanks and Regards
Dibyendu
On Friday, 26 February 2016 at 11:03:43 UTC, Dibyendu Majumdar
wrote:
Hi,
How do I use a double value in a mixin template that is
generating string?
Thanks and Regards
Dibyendu
Have you an example of what's failing right now to show ?
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 th
On Friday, 26 February 2016 at 11:13:08 UTC, Dibyendu Majumdar
wrote:
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 ~ ")";
No you cannot because you would have to co
On Friday, 26 February 2016 at 11:26:51 UTC, BBasile wrote:
No you cannot because you would have to convert the values to
string using std.conv.to or std.format.format(), but they don't
work at compile time (see
https://issues.dlang.org/show_bug.cgi?id=13568).
Erratum! Actually you can, examp
On Friday, 26 February 2016 at 11:37:32 UTC, BBasile wrote:
Erratum! Actually you can, example:
import std.stdio;
string foo(double a)()
{
return "auto value = " ~ a.stringof ~ ";";
}
void main(string[] args)
{
mixin(foo!0.1);
writeln(value); // 0.1
writeln(typeof(value).string