Streamline std.traits.AliasThisTypeOf

Faster and uses less memory.
This commit is contained in:
Nathan Sashihara 2020-09-12 14:38:26 -04:00 committed by The Dlang Bot
parent 33b1c17540
commit aa16e2d99a

View file

@ -5659,17 +5659,7 @@ Note: Trying to use returned value will result in a
// SomethingTypeOf
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
private template AliasThisTypeOf(T)
{
alias members = __traits(getAliasThis, T);
static if (members.length == 1)
{
alias AliasThisTypeOf = typeof(__traits(getMember, T.init, members[0]));
}
else
static assert(0, T.stringof~" does not have alias this type");
}
private alias AliasThisTypeOf(T) = typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0]));
/*
*/