How to reliably detect an alias sequence?

Max Samukha maxsamukha at gmail.com
Sun Dec 27 12:23:26 UTC 2020


Given a name bound to an alias sequence, what is a reliable way 
to detect that?

import std.meta: AliasSeq;

alias a = AliasSeq!int;

static if (<is a an AliasSeq>) {

}

__traits(isSame, a, AliasSeq!a) could work but doesn't, because 
it flattens singletons, which means __traits(isSame, int, 
AliasSeq!int) is true. (A bug/bad design, IMO. If the intended 
behavior is not to flatten tuples passed to __traits, there is no 
reason to make a special case for singletons).


More information about the Digitalmars-d-learn mailing list