functionAttributes

Returns the FunctionAttribute mask for function func.

template functionAttributes (
alias func
) if (
isCallable!func
) {
enum FunctionAttribute functionAttributes;
}

Examples

alias FA = FunctionAttribute; // shorten the enum name

real func(real x) pure nothrow @safe
{
    return x;
}
static assert(functionAttributes!func & FA.pure_);
static assert(functionAttributes!func & FA.safe);
static assert(!(functionAttributes!func & FA.trusted)); // not @trusted

See Also

Meta