FunctionAttribute

Returns the FunctionAttribute mask for function func.

Values

ValueMeaning
none0

These flags can be bitwise OR-ed together to represent a complex attribute.

pure_1 << 0

ditto

nothrow_1 << 1

ditto

ref_1 << 2

ditto

property1 << 3

ditto

trusted1 << 4

ditto

safe1 << 5

ditto

nogc1 << 6

ditto

system1 << 7

ditto

const_1 << 8

ditto

immutable_1 << 9

ditto

inout_1 << 10

ditto

shared_1 << 11

ditto

return_1 << 12

ditto

scope_1 << 13

ditto

live1 << 14

ditto

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