On 3/31/2014 10:02 PM, Manu wrote:'alias this' is inelegant (sorry Andrei) but it was designed for precisely this purpose - being able to use a struct to wrap any other type, and forward to and override behaviors of that type. Nobody has found a better way.
It's a really common pattern, it's obviously very useful, but it's surprising to
me that people think that it's like, 'cool'.
I get why it's done, and it's cool that D can do this (I use it a lot in my
code), but I don't feel it's particularly elegant.
Fortunately, the inelegance can be encapsulated within that type, and the user of the type need not be even aware of it.
Remember my halffloat implementation? It relied on 'alias this' to work. Just try doing that in C++ <g>.