Emulates static if (Type : Template!(Args), Args...), which is a D2
feature
Given a template and an instance of it, allows to get the arguments used
to instantiate this type.
An example use case is when you want to wrap an aggregate which is templated
and need your Wrapper class to be templated on the aggregate's template
arguments:
This can also be used to see if a given symbol is an instance of a template:
static if (is(TemplateInstanceArgs!(Template, PossibleInstance)))
Note that eponymous templates can lead to surprising behaviour:
templateIdentity (T)
{
aliasTIdentity;
}
// The following will fail, because `Identity!(char)` resolves to `char` !staticassert(is(TemplateInstanceArgs!(Identity, Identity!(char))));
As a result, this template is better suited for template aggregates,
or templates with multiple members.
Emulates static if (Type : Template!(Args), Args...), which is a D2 feature
Given a template and an instance of it, allows to get the arguments used to instantiate this type.
An example use case is when you want to wrap an aggregate which is templated and need your Wrapper class to be templated on the aggregate's template arguments:
This can also be used to see if a given symbol is an instance of a template: static if (is(TemplateInstanceArgs!(Template, PossibleInstance)))
Note that eponymous templates can lead to surprising behaviour:
As a result, this template is better suited for template aggregates, or templates with multiple members.