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

2018-03-12 Thread aliak via Digitalmars-d-learn
On Monday, 12 March 2018 at 04:15:23 UTC, Simen Kjærås wrote: 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,

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

2018-03-11 Thread Simen Kjærås via Digitalmars-d-learn
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

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

2018-03-11 Thread aliak via Digitalmars-d-learn
On Sunday, 11 March 2018 at 13:44:38 UTC, Basile B. wrote: The first version works here: ``` template aliasOf(T) { enum aliasOf(alias a) = is(typeof(a) == T); } string s; pragma(msg, allSatisfy!(aliasOf!string, s, "string")); ``` I can see that my description was a little confusing,

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

2018-03-11 Thread Basile B. via Digitalmars-d-learn
On Sunday, 11 March 2018 at 12:05:56 UTC, aliak wrote: Eg: template aliasOf(T) { enum aliasOf(alias a) = is(typeof(a) == T); } The use case for this is for std.meta.allSatisfy for variadic args, i.e. template T(values...) if (allSatisfy!(aliasOf!string, values) { ... } But how do you