templated isNaN
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Sat Aug 24 06:01:08 PDT 2013
On 24/08/13 14:50, Joseph Rushton Wakeling wrote:
> static if (isNumeric!T)
> {
> return std.math.isNaN(t);
> }
Note that the correct if () condition here depends on how you want your isNaN to
behave in certain cases. Using isNumeric will mean isNaN('c') returns true. If
you want isNaN to return false when passed a char type, use your if(is(T :
real)) instead.
More information about the Digitalmars-d-learn
mailing list