On Tuesday, 16 September 2014 at 17:32:02 UTC, amparacha wrote:
Thanks Adam you saved me from alot.Just one more question how
can
I compare two arguments of type T.
If you want to compare the values, just use them like regular
variables. If you want to compare the types, use:
static if(is(T == R)) { }
or one of the other forms here
http://dlang.org/expression.html#IsExpression
For example:
bool typesMatch(T, R)() {
static if(is(T == R)) return true;
return false;
}
writeln(typesMatch!(int, float)); // false
writeln(typesMatch!(int, int)); // true