Using core.reflect to rewrite code

Adam D Ruppe destructionator at gmail.com
Fri Aug 13 12:51:21 UTC 2021


On Thursday, 12 August 2021 at 04:47:52 UTC, Stefan Koch wrote:
> Yes but I am still not quite sure how to write the equivalent 
> template ;)

You'd just loop through the members, see if there's the struct 
pointer as the argument, and if so, generate a forwarder function 
with the &this passed to it.

Though I wouldn't generate an actual wrapper here since UFCS does 
the same thing in practice, I have done similar in my script 
wrapper for ufcs

http://arsd-official.dpldocs.info/source/arsd.jsvar.d.html#L2480


More information about the Digitalmars-d mailing list