Argument deduction for alias templates

ag0aep6g anonymous at example.com
Thu Jan 7 16:43:59 UTC 2021


On Thursday, 7 January 2021 at 16:18:53 UTC, Paul wrote:
> While trying out eponymous alias templates, I noticed they 
> don't feature argument deducitions at all, even though the 
> compiler knows what types are given, as can be told from the 
> exceptions it's giving. Additonally, eponymous alias templates 
> seem to only function when at least 1 argument is given, even 
> if default values are used, which is slightly disappointing as 
> this is not the case for eponymous function templates.

You're right that there is no deduction being done. Deduction 
only happens with function templates (and even then only in 
limited form). With other kinds of templates, you have to spell 
out the instantiation.

You're not exactly right about having to supply at least one 
argument. You can instantiate a template without any arguments: 
`Foo!()`. But you have to type out the "!()" part.


More information about the Digitalmars-d mailing list