Inconsistency between `AllMembers` and `hasMember`
drug
drug2004 at bk.ru
Sun Nov 18 10:36:54 UTC 2018
On 18.11.2018 5:37, Stanislav Blinov wrote:
>
> It's only "hidden" in that there's no symbol to access it. But you can
> still access it via .tupleof, and it still of course affects the ABI
> (i.e. S.sizeof is always at least pointer size when S is nested).
> If you want to iterate fields, .tupleof is a better way to do it. As for
> that hidden pointer, you can just test with __traits(isNested, S)
> whether that's present, and just don't look at the last field.
But what is the reason for someone to use this pointer even via
.tupleof? I still think AllMember shouldn't return it at all. Of course
I can filter it using isNested or just comparing with "this" leteral
during iteration. But it complicates things I believe.
P.S. using isNested seems to be more portable solution than comparing
with leteral but is this pointer always the last element in AllMember
trait result?
More information about the Digitalmars-d-learn
mailing list