On Mon, Mar 15, 2010 at 16:12, Steven Schveighoffer <span dir="ltr"><<a href="mailto:schveiguy@yahoo.com">schveiguy@yahoo.com</a>></span> wrote:<br><br><div class="gmail_quote"><div>(On alias this) <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Yeah, I tried to get it to work too, but it doesn't. Even something like this doesn't work:<br>
<br>
struct Foo {<br>
uint x;<br>
uint castToUint() { return x; }<br>
alias castToUint this;<br>
}<br>
<br>
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:<br>
<br>
alias opCast!uint this;<br>
<br>
A bug filing is in order I think.<br></blockquote><div><br>I never got 'alias this' to work. Regularly, someone posts some cool possible code here, and I can't get it to compile :(<br>And IIRC, you can have only one alias this in an object, which somewhat limits its usefulness.<br>
<br>Philippe<br></div></div>