On Thursday, 1 March 2018 at 17:48:02 UTC, Simen Kjærås wrote:
On Thursday, 1 March 2018 at 16:46:30 UTC, Yuxuan Shui wrote:
[...]
string TemplateStringOf(T...)()
if (T.length == 1)
{
import std.traits : TemplateOf, TemplateArgsOf;
import std.meta : AliasSeq, staticMap;
import std.string : indexOf;
import std.conv : text;
static if (is(typeof({ alias a = TemplateOf!T; })))
{
alias Tmp = TemplateOf!T;
alias Args = TemplateArgsOf!T;
[...]
Ah, thanks. I was trying to match template instantiation using
is() (i.e. is(T == S!R, S, R...)). But this doesn't work if T is
a template.
Reading the code of TemplateOf, I realized I have to use template
constraints for that. Maybe we can add support for something like
is(alias T == ...)?