Template argument deduction and default args

Manu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 24 08:11:56 PDT 2014


On 24 July 2014 22:15, Daniel Murphy via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> "Manu via Digitalmars-d" <digitalmars-d at puremagic.com> wrote in message
> news:mailman.274.1406201953.32463.digitalmars-d at puremagic.com...
>
>
> Is it possible for templates or types to both appear in the same context
> and create an actual ambiguity? What would that expression look like?
>
> alias X = T!U;
>
> What is U?  Did you mean to pass the template or the type?
>

I didn't specify, and I don't think this code requires that I do.

T will resolve this situation naturally.
Is it 'template T(X)'? Obviously the type.
Is it 'template T(alias X)'? this could be the type or the template, but
since the template is more inclusive, it should be that. Within T's
definition, if T is passed as the template, then the opportunity is
retained to go either way as is necessary when the context becomes explicit.
I actually think it works quite elegantly. What have I missed?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140725/1bf1a6ed/attachment.html>


More information about the Digitalmars-d mailing list