traits for function having actual source declaration?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 1 11:06:04 PDT 2017


On Friday, September 01, 2017 14:38:38 bitwise via Digitalmars-d-learn 
wrote:
> When I'm using __traits(allMembers), I get a all the invisible
> functions added by the compiler as well "__ctor", "__xdtor",
> "__cpctor", etc..
>
> Is there a way to filter them out?

You can use std.meta.Filter if you need to filter anything out of an
AliasSeq like this, and whether you should be filtering out those functions
is highly dependent on what you're doing - e.g. sometimes, you really want
to get your hands on __ctor, whereas other times, that's not at all what
you're looking for. But because it gives you everything, you have a choice,
whereas if they were filtered out, then any code that needed to know about
them would be screwed.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list