Trying to forward unwrapped opDispatch names to alias this

Adam D. Ruppe destructionator at gmail.com
Tue Feb 20 16:12:17 UTC 2018


On Monday, 19 February 2018 at 08:28:22 UTC, aliak wrote:
> T is the wrapped type. So if T has a member (in the example 
> it's the built in field "max") then forward that.

Oh, I see what you mean.

So the problem is that built in types don't have "members" per 
se, they have "magic". The built in properties don't count to 
`hasMember`. You could probably do `if(__traits(compiles, 
mixin("a." ~ member))` though.

> I assume this should work because rules for alias this (as I 
> understand) are to basically try if there's a member name that 
> resolves the call, else forward to alias this.

yeah, just built in properties/members don't pass the same 
existence checks so that's confusing your template constraint.


More information about the Digitalmars-d-learn mailing list