Template: get function name
MoonlightSentinel
moonlightsentinel at disroot.org
Mon Aug 17 10:11:29 UTC 2020
On Monday, 17 August 2020 at 09:59:21 UTC, novice3 wrote:
> On Monday, 17 August 2020 at 09:45:55 UTC, novice3 wrote:
>> access violation occur.
>
> reduced code https://run.dlang.io/is/U58t9R
The wrapper parameters don't inherit the storage classes from
the wrapped function. Try using std.traits.Parameters instead:
https://run.dlang.io/is/wTyJWD.
```
import std.traits : Parameters;
void test(out int x) { x = 42; }
void call (alias fn)(Parameters!fn args) { fn(args); }
void main()
{
int a;
a = 111;
test(a);
assert(a == 42);
a = 222;
call!test(a);
assert(a == 42);
}
```
More information about the Digitalmars-d-learn
mailing list