The OpenD Programming Language

isUnsigned

Detect whether T is a built-in unsigned numeric type.

template isUnsigned (
T
) {
static if(!__traits(isUnsigned, T))
enum isUnsigned;
static if(!(!__traits(isUnsigned, T)))
static if(is(T U == enum))
enum isUnsigned;
static if(!(!__traits(isUnsigned, T)))
static if(!(is(T U == enum)))
enum isUnsigned;
}

Examples

static assert(
    isUnsigned!uint &&
    isUnsigned!ulong
);

static assert(
    !isUnsigned!char &&
    !isUnsigned!int &&
    !isUnsigned!long &&
    !isUnsigned!char &&
    !isUnsigned!wchar &&
    !isUnsigned!dchar
);

Meta