Extracting user defined attributes on function parameters

Jean-Louis Leroy jl at leroy.nyc
Tue Apr 14 21:35:12 UTC 2020


I can see them:

     import std.traits;

     struct foo;
     struct bar;

     void f(@foo int, @foo @bar @("baz") real);

     pragma(msg, Parameters!f);
     // (@(foo) int, @(tuple(tuple(foo), tuple(bar)), 
tuple("baz")) real)

...but I cannot find how to get hold of them:

     pragma(msg, (Mystery!f)[0]); // foo
     pragma(msg, __traits(mystery, f)[0]); // foo

And besides the structure looks weird for the second argument. 
It's as if the UDAs were applied to one another, from left to 
right.

I did search the documentation and google for 1/2 hour.




More information about the Digitalmars-d-learn mailing list