check instance of nested variadic template
Basile B. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Nov 5 07:37:53 PDT 2016
On Saturday, 5 November 2016 at 13:34:51 UTC, Gianni Pisetta
wrote:
> When i have time i will test it with ldc and see if the result
> is the same, then it will probably be a front-end bug and i
> will report it as an issue.
Indeed, I've been fighting against that since a few minutes. We
cant select the Base of an eponymous template.
template isEponymousTemplate(T)
{
static if (is(T == class) || is(T == interface) || is(T ==
struct) || is(T == union))
{
enum p = __traits(parent, T).stringof == T.stringof;
enum isEponymousTemplate = p && isTemplateInstance!T;
}
else
enum isEponymousTemplate = false;
}
template TemplateBase(T : Base!Args, alias Base, Args...)
if (is(T == class) || is(T == interface) || is(T == struct) ||
is(T == union))
{
alias TemplateBase = Base;
}
More information about the Digitalmars-d-learn
mailing list