mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Streamline std.traits.AliasThisTypeOf
Faster and uses less memory.
This commit is contained in:
parent
33b1c17540
commit
aa16e2d99a
1 changed files with 1 additions and 11 deletions
12
std/traits.d
12
std/traits.d
|
@ -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]));
|
||||
|
||||
/*
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue