Hi,

I'm trying to allow implicit conversions for my own type happening. I have the following:

----
import std.math;
import std.traits;

struct S(T)
if(isFloatingPoint!T)
{
    T val;
    alias val this;
}
void main()
{

    auto s = S!float();
    assert(isNaN(s));
    s = 10.0;
    assert(!isNaN(s));
}
----

But I get a compile time error:

----
Error: template std.math.isNaN cannot deduce function from argument types !()(S!float), candidates are:

std/math.d(4171): std.math.isNaN(X)(X x) if (isFloatingPoint!X)
----

Is there a way I can to do this, maybe opCall/opCast (I tried these but failed)?

Cheers,
uri

Reply via email to