When to use typecons.proxy vs alias this?
weaselcat via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 24 21:57:36 PST 2015
On Sunday, 25 January 2015 at 03:55:18 UTC, Adam D. Ruppe wrote:
> Use alias this if you want implicit conversions too.
>
> Proxy keeps the types separate
>
> void foo(Base b) { }
>
> struct Modified {
> Base b;
> alias b this;
> }
>
> foo(Modified()); //works
>
>
> That wouldn't work if it was proxied though, which you
> sometimes want to force everything to go through your
> modification.
So the only difference is that proxy doesn't have implicit
conversions? Hm. Might be worth pointing out on the docs.
More information about the Digitalmars-d-learn
mailing list