isBoolean

Determines whether T is a boolean type, i.e. $(D_KEYWORD bool).

enum bool isBoolean(T);

Return Value

$(D_KEYWORD true) if T is a boolean type, $(D_KEYWORD false) otherwise.

Examples

static assert(isBoolean!bool);
static assert(isBoolean!(shared const bool));
static assert(!isBoolean!(ubyte));
static assert(!isBoolean!(byte));

enum E : bool
{
    t = true,
    f = false,
}
static assert(isBoolean!E);

static struct S1
{
    bool b;
    alias b this;
}
static assert(!isBoolean!S1);

static struct S2
{
    bool opCast(T : bool)()
    {
        return true;
    }
}
static assert(!isBoolean!S2);

Meta