On Wednesday, 23 September 2020 at 01:57:08 UTC, Adam D. Ruppe
wrote:
On Wednesday, 23 September 2020 at 01:45:46 UTC, Steven
Schveighoffer wrote:
@foo int z; // Error: cannot interpret foo(T)(T val) at
compile time
Where do you get that error? Is it from phobos' thing? cuz I
copy/pasted your code and it compiled.
You can also just use a struct as the uda if your detection
function checks for both the type and a value of the type, so
it really depends on which search method you using.
I just said pragma(msg, __traits(getAttributes, z))
Well actually the thing I tried is slightly different. As usual I
dumbed it down to post here (maybe was a bad idea).
A struct won’t work because the foo(val) form needs to hold any
type and ifti doesn’t work on constructors.
-Steve