ParameterStorageClassTuple

Get tuple, one per function parameter, of the storage classes of the parameters.

  1. enum ParameterStorageClass
  2. template ParameterStorageClassTuple(func...)
    template ParameterStorageClassTuple (
    func...
    ) if (
    func.length == 1 &&
    isCallable!func
    ) {}

Parameters

func

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

Return Value

A tuple of ParameterStorageClass bits

Examples

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

Meta

Suggestion Box / Bug Report