ParameterStorageClassTuple

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

template ParameterStorageClassTuple (
alias func
) if (
isCallable!func
) {}

Parameters

func

function symbol or type of function, delegate, or pointer to function

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