On Tuesday, 28 October 2014 at 20:09:07 UTC, IgorStepanov wrote:
And please comment my way to resolving "is" expression via
alias-this:
http://forum.dlang.org/thread/[email protected]?page=5
Something else related to the discussion about `is` from this
thread:
http://forum.dlang.org/post/[email protected].
The following code:
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));
}
Current fails to compile with this 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 this a problem with the current implementation of `alias
this`, or should isFloatingPoint be changed so that it also
accepts types that alias a floating point type?