I'm sure that's true, I've just always used it to gain access to members of embedded types, kinda of like abstraction for 'struct's. It hadn't occurred to me to support explicit casting in that way.<div class="gmail_extra">
<br><br><div class="gmail_quote">On 18 November 2012 18:31, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 11/18/12 7:30 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 18 November 2012 14:01, David Nadlinger <<a href="mailto:see@klickverbot.at" target="_blank">see@klickverbot.at</a><div><div class="h5"><br>
<mailto:<a href="mailto:see@klickverbot.at" target="_blank">see@klickverbot.at</a>>> wrote:<br>
<br>
    On Sunday, 18 November 2012 at 11:21:37 UTC, Manu wrote:<br>
<br>
        someFloat = someHalf <- doesn't work, because a cast operator<br>
        expects an<br>
        explicit cast, even though this is a lossless conversion and<br>
        should be<br>
        exactly the same as someDouble = someFloat.<br>
<br>
        Thoughts?<br>
<br>
<br>
    ---<br>
    struct Half {<br>
         float toFloat() { return 3.14f; }<br>
         alias toFloat this;<br>
    }<br>
<br>
    void test() {<br>
         Half h;<br>
         float f = h;<br>
         double d = h;<br>
    }<br>
    ---<br>
<br>
    Works for you?<br>
<br>
<br></div></div><div class="im">
Interesting approach to the implicit cast problem. Very handy trick.<br>
</div></blockquote>
<br>
Well that was quite explicitly part of the purpose of alias this.<span class="HOEnZb"><font color="#888888"><br>
<br>
Andrei<br>
</font></span></blockquote></div><br></div>