On Friday, 19 August 2016 at 01:53:22 UTC, Engine Machine wrote:
On Friday, 19 August 2016 at 01:25:10 UTC, Anonymouse wrote:
On Friday, 19 August 2016 at 01:10:42 UTC, Engine Machine
x = 1.234;
Ok, well, I guess the error comes from something else.
*x = 1.234 for when T verifies is(T == int*) produces an error.
You can put an aditional argument in the function header:
void foo(T)(auto ref T t = T.init)
{
static if (is(T == int))
auto x = new Thing!int;
else static if (is(T == double))
auto x = new Thing!double;
else
static assert(false, "incorrect type");
*x = t;
}