Robert Clipsham: > The closest I've managed with my quick attempt is: > ---- > mixin template typeOf() > { > alias typeof(this) typeOf; > } > struct Foo > { > int x; > mixin typeOf; > }
Thank you for your code :-) Your example shows this feature can become a built-in. > I changed fsize to auto, as the type > of .sizeof is different on x86_64, this isn't an issue now, but it's > nice to keep code portable! You are right, thank you. At the moment it's a size_t, that is an unsigned CPU word. (I have recently asked in bugzilla for all those values to become signed words, because unsigned are too much unsafe in a language that doesn't catch signed-unsigned conversions and has no integral overflows tests). Bye, bearophile