ifTestable

enum ifTestable (
T
alias pred = a => a
)

Return Value

true iff the type T can be tested in an if-expression, that is if if (pred(T.init)) {} is compilable.

Examples

class C;
struct S1;
struct S2
{
    T opCast(T)() const;
}

static assert( ifTestable!bool);
static assert( ifTestable!int);
static assert( ifTestable!(S1*));
static assert( ifTestable!(typeof(null)));
static assert( ifTestable!(int[]));
static assert( ifTestable!(int[string]));
static assert( ifTestable!S2);
static assert( ifTestable!C);
static assert(!ifTestable!S1);

Meta