ParameterStorageClass

Get tuple, one per function parameter, of the storage classes of the 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

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