ParameterStorageClass

Get a tuple of the storage classes of a function's parameters.

Values

ValueMeaning
none0x00

These flags can be bitwise OR-ed together to represent complex storage class.

in_0x01

ditto

ref_0x02

ditto

out_0x04

ditto

lazy_0x08

ditto

scope_0x10

ditto

return_0x20

ditto

Return Value

A tuple of ParameterStorageClass bits

Examples

alias STC = ParameterStorageClass; // shorten the enum name

void func(ref int ctx, out real result, in real param, void* ptr)
{
}
alias pstc = ParameterStorageClassTuple!func;
static assert(pstc.length == 4); // number of parameters
static assert(pstc[0] == STC.ref_);
static assert(pstc[1] == STC.out_);
version (none)
{
    // TODO: When the DMD PR (dlang/dmd#11474) gets merged,
    // remove the versioning and the second test
    static assert(pstc[2] == STC.in_);
    // This is the current behavior, before `in` is fixed to not be an alias
    static assert(pstc[2] == STC.scope_);
}
static assert(pstc[3] == STC.none);

Meta