How to get only the field name from an alias?

Elfstone elfstone at yeah.net
Wed Feb 22 10:22:27 UTC 2023


On Tuesday, 21 February 2023 at 12:32:51 UTC, Adam D Ruppe wrote:
> On Tuesday, 21 February 2023 at 02:41:34 UTC, Elfstone wrote:
>> apparently F.stringof
>
> You almost never want to use .stringof, instead try 
> __traits(identifier, F) and see what it gives you.
>
>
> Alternatively, loop over __traits(allMembers) which gives you 
> the member names and pass that down. You can pull all the info 
> out of allMembers with getMember and then other things to 
> filter it out.

Thanks, Adam! Didn't know such a trait existed and that it could 
work for aliases.



More information about the Digitalmars-d-learn mailing list