On Mon, Mar 15, 2010 at 16:12, Steven Schveighoffer <schvei...@yahoo.com>wrote:
(On alias this) > Yeah, I tried to get it to work too, but it doesn't. Even something like > this doesn't work: > > struct Foo { > uint x; > uint castToUint() { return x; } > alias castToUint this; > } > > This should work. The template code you wrote above might not work, > because you can't overload functions on no arguments. I'm unsure how this > should work, but at least something like this should: > > alias opCast!uint this; > > A bug filing is in order I think. > I never got 'alias this' to work. Regularly, someone posts some cool possible code here, and I can't get it to compile :( And IIRC, you can have only one alias this in an object, which somewhat limits its usefulness. Philippe