The OpenD Programming Language

isFloatingPoint

Detect whether T is a built-in floating point type.

See also: __traits(isFloating, T)

enum bool isFloatingPoint(T);

Examples

static assert(
    isFloatingPoint!float &&
    isFloatingPoint!double &&
    isFloatingPoint!real &&
    isFloatingPoint!(const(real)) &&
    isFloatingPoint!(immutable(real))
);

static assert(!isFloatingPoint!int);

// types which act as floating point values do not pass
struct S
{
    float val;
    alias val this;
}

static assert(!isFloatingPoint!S);

Meta