Can you get typeof(this) in a mixin template - trying to mimic a Kotlin feature here.

aliak something at something.com
Wed Aug 29 06:12:33 UTC 2018


On Tuesday, 28 August 2018 at 20:58:23 UTC, Alex wrote:
>
> Isn't the problem, that inside a template a declaration is 
> expected, and not a foreach?
>


Boh, you're right. I guess I misunderstood mixin templates. Found 
a way with a normap function though :p

void mapSelf(alias self, alias aa)() { ... }

this(map) {
    mapSelf!(this, map);
}

https://run.dlang.io/is/EhDpOM




More information about the Digitalmars-d-learn mailing list