[Issue 24227] Add a trait to check if symbol is an alias

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 4 13:41:55 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24227

--- Comment #1 from Marcelo Silva Nascimento Mancini <msnmancini at hotmail.com> ---
With help from Paul and Steven, this is the best I could find right now for
alias checking:

```d
//Checks if the symbol got has the same alias name
//And if it points to a member
bool isAliasMember(T, string member)()
{

        return __traits(identifier, __traits(getMember, T, member)) == member
&&
                __traits(isSame, T, __traits(parent, __traits(getMember, T,
member)));
}
```

--


More information about the Digitalmars-d-bugs mailing list