开发者

Where is alias this defined

When programming a C++ application I needed a class that supported interfaces. After implmenting it with MI is had a big ugh moment when I realized if I wasn't careful I would introduce diamond inheritance and that I should probably virtually inherit my interfaces. Further, the only elegant way to implement the code required dynamic_cast.

About this point I thought there must be a better way. When I remember reading about subtypeing/alias this in TDPL. I copied the basic idea into my class. I think the solution is much more elegant, but not coventional.

To preemptively justify my code, I was hoping that I could link to a page that describes the alias this feature of D. However I could find one on the website.

Where is subtypeing / alias this described officia开发者_高级运维lly?


http://www.digitalmars.com/d/2.0/class.html#AliasThis

But I think this might be a little bit out of date. IIRC TDPL describes the possibility of several alias this per class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜