alias this to a template function
Adam D. Ruppe
destructionator at gmail.com
Sun Nov 11 14:08:36 PST 2012
On Sunday, 11 November 2012 at 21:42:45 UTC, Peter Alexander
wrote:
> How can the compiler possibly figure out what T is supposed to
> be?
How does it figure out which alias this right now? Looking at the
dmd source, it looks like it calls implicitCastTo, which
eventually calls another function to resolve the alias this. The
requested type is known to the implicit cast function, so it's
possible to pass that on and use it as the template argument.
Since I think knowing the requested type would be necessary to
resolve multiple alias this, I figure it will be changed to pass
it on eventually anyway.
But actually instantiating the template is another step that
doesn't match the normal dot behavior, as you pointed out, so
that left me wondering if they were planning to do it or not.
It'd be different than the normal deduction, but it'd be
potentially useful too, expanding alias this to work on more than
just a pre-written list of types.
More information about the Digitalmars-d
mailing list