How do you call an eponymous template that has a secondary template arg?

Simen Kjærås simen.kjaras at gmail.com
Mon Mar 12 04:15:23 UTC 2018


On Sunday, 11 March 2018 at 12:05:56 UTC, aliak wrote:
> * aliasOf!int!"string" // multiple ! arguments are not allowed
> * (aliasOf!int)!"string" // error c-style cast
> * aliasOf!int.aliasOf!"string" // template isAliasOf(alias a) 
> does not have property 'isAliasOf

Yeah, that's a little hole in the grammar, but there are ways:

// Declare an alias:
alias aliasOfInt = aliasOf!int;

// And use that:
assert(!aliasOfInt!string);


Or use std.meta.Instantiate:

assert(!Instantiate!(aliasOf!int, string));

--
   Simen


More information about the Digitalmars-d-learn mailing list